Intel® Collaboration Suite for WebRTC
Community support and discussions on the Intel® Collaboration Suite for WebRTC (Intel® CS for WebRTC).

windows 自定义音视频流

Hr__Z
New Contributor I
1,041 Views

使用IntelCS webrtc V4.1

 

分别实现接口:ics::base::AudioFrameGeneratorInterface和ics::base::VideoFrameGeneratorInterface,

音频pcm,44100,2通道,

视频h264, 1280x720,30fps

在调试过程中发现,新建LocalStream实例,尚未publish流的时候,SDK就已经调用VideoFrameGeneratorInterface的uint32_t GenerateNextFrame(uint8_t* buffer,
        const uint32_t capacity);

不论是否在该函数返回h264数据都会崩溃在SDK里

 

TIM图片20190125172920.png

AudioFrameGeneratorInterface实现

TIM图片20190125173154.png

VideoFrameGeneratorInterface实现:

TIM图片20190125173159.png

 

请问未publish的时候就调用VideoFrameGeneratorInterface的GenerateNextFrame是否合理?另外是否有ics 的pdb文件可供调试?

0 Kudos
4 Replies
Jincheng_S_Intel
Employee
1,041 Views

VideoFrameGeneratorInterface接口在设计时是考虑到用户可能在本地去渲染不publish,和Camera流一样,所以是不需要publish就会调用GenerateNextFrame. 目前该接口的视频格式为VideoFrameGeneratorInterface::I420. 4.2的版本我们已经开源了,你可以通过https://github.com/open-media-streamer/oms-client-native 看到我们的源码.

0 Kudos
Hr__Z
New Contributor I
1,041 Views

谢谢。

 

查看了源码,格式是I420,接口返回的大小也必须完全匹配,已解决问题

 

不过使用了VideoFrameGeneratorInterface接口,AudioFrameGeneratorInterface的GenerateFramesForNext10Ms并不被调用

    ics::base::GlobalConfiguration::SetCustomizedAudioInputEnabled(true, std::unique_ptr<ics::base::AudioFrameGeneratorInterface>(new IcsLocalAudioFrameGenerator()));
已设置

0 Kudos
Hr__Z
New Contributor I
1,041 Views

在文档里找到了答案:

https://software.intel.com/sites/products/documentation/webrtc/android/index.html#section1

 

11 Customize audio input

Instead of getting audio data from device microphone, our Android client SDK allows customizing audio input which enables media stream to get audio data from the source that application customizes. To set a customized audio input, please follow these steps:

Implement com.intel.webrtc.base.IcsAudioRecord.AudioFrameGeneratorInterface;

Call WebRtcUtils.setCustomizedAudioInput(AudioFrameGeneratorInterface) before instantiating PeerClient or ConferenceClient;

Note: * Other names and brands may be claimed as the property of others.

0 Kudos
jiang__meng
Beginner
1,041 Views

你好,我也在用VideoFrameGeneratorInterface这个接口实现自定义流,能指点一下这个类里的方法GenerateNextFrame 在子类里该怎么实现吗?我看你的截图中传了一个回调函数,这个回调函数干什么用的?

0 Kudos
Reply