send a multicast audio in rtsp using libstreaming for upstreaming from an android device

匿名 (未验证) 提交于 2019-12-03 02:30:02

问题:

The code is only streaming for one user at a time. Can anyone help me to play the stream in more than one system at the same time(convert it to multicast or broadcast). Thanks in advance.

The library source is over here: https://github.com/fyhertz/libstreaming

my current code is:

    mSurfaceView = (net.majorkernelpanic.streaming.gl.SurfaceView) findViewById(R.id.surface);      // Sets the port of the RTSP server to 1234     Editor editor = PreferenceManager.getDefaultSharedPreferences(this).edit();     editor.putString(RtspServer.KEY_PORT, String.valueOf(5060));                                                            // audio port num                    editor.commit();      // Configures the SessionBuilde     SessionBuilder.getInstance()     .setSurfaceView(mSurfaceView)     .setPreviewOrientation(90)     .setContext(getApplicationContext())     .setAudioEncoder(SessionBuilder.AUDIO_AAC)     .setVideoEncoder(SessionBuilder.VIDEO_NONE);       MainActivity.this.startService(new Intent(MainActivity.this,RtspServer.class)); 

回答1:

I looked at the code at github and seems that you only need to specify the multicast address to the SessionBuilder class and then the underlying RTSP server and RTP transport should handle everything (at least the RTSP responses seem have code to produce correct transport descriptions). So I guess adding a setDestination call to your SessionBuilder configuration should be ok (replace the 232.0.1.2 with the address you need):

// Configures the SessionBuilde SessionBuilder.getInstance() .setSurfaceView(mSurfaceView) .setPreviewOrientation(90) .setContext(getApplicationContext()) .setAudioEncoder(SessionBuilder.AUDIO_AAC) .setVideoEncoder(SessionBuilder.VIDEO_NONE) .setDestination("232.0.1.2"); 

The clients will still connect to the RTSP server through it's address but the actual RTP stream should be single and shared among all the clients.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!