首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在rtsp中使用libstreaming发送组播音频,以便从android设备上行

在rtsp中使用libstreaming发送组播音频,以便从android设备上行
EN

Stack Overflow用户
提问于 2014-10-16 21:20:32
回答 1查看 1.8K关注 0票数 4

代码一次只为一个用户流式传输。是否有人可以帮助我同时在多个系统中播放流(将其转换为多播或广播)。提前谢谢。

库的源代码在这里:https://github.com/fyhertz/libstreaming

我当前的代码是:

代码语言:javascript
复制
    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));
EN

回答 1

Stack Overflow用户

发布于 2014-10-17 00:25:06

我看了github上的代码,似乎你只需要指定SessionBuilder类的组播地址,然后底层的RTP服务器和RTP传输应该处理一切(至少RTSP响应似乎有代码来产生正确的传输描述)。所以我想在你的SessionBuilder配置中添加一个setDestination调用应该没问题(用你需要的地址替换232.0.1.2 ):

代码语言:javascript
复制
// Configures the SessionBuilde
SessionBuilder.getInstance()
.setSurfaceView(mSurfaceView)
.setPreviewOrientation(90)
.setContext(getApplicationContext())
.setAudioEncoder(SessionBuilder.AUDIO_AAC)
.setVideoEncoder(SessionBuilder.VIDEO_NONE)
.setDestination("232.0.1.2");

客户端仍将通过其地址连接到RTSP服务器,但实际的RTP流应该是单一的,并在所有客户端之间共享。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26405539

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档