[英]WebRTC - Recording audio stream into file from within C++ application
I am playing around with WebRTC's "..\\trunk\\talk\\examples\\peerconnection" sample. 我正在玩WebRTC的“.. \\ trunk \\ talk \\ examples \\ peerconnection”示例。
I have modified "..\\peerconnection\\server\\server_test.html" so it streams audio to "peerconnection_client.exe". 我修改了“.. \\ peerconnection \\ server \\ server_test.html”,因此它将音频流传输到“peerconnection_client.exe”。 This is working fine and the following function:
这工作正常,以下功能:
int32_t Channel::ReceivedRTPPacket(const int8_t* data, int32_t length, const PacketTime& packet_time)
shows incoming RTP packets sent from Chrome. 显示从Chrome发送的传入RTP数据包。
How can I save this RTP packet stream into a file (.pcm format?) from within the receiving side? 如何从接收方内将此RTP数据包流保存到文件(.pcm格式?)中?
When you get the remote stream (OnStreamAdded) in your c++ application you can add an AudioTrackSink
to the audio track and write raw PCM data. 当您在c ++应用程序中获得远程流(OnStreamAdded)时,您可以将
AudioTrackSink
添加到音频轨道并写入原始PCM数据。
Also see here: Writing WebRTC (AudioTrackSinkInterface) raw audio to disc 另请参见此处: 将WebRTC(AudioTrackSinkInterface)原始音频写入光盘
(Yes, this question was old but the web lacks information about the native webrtc library so I wanted to add) (是的,这个问题很老但是网络上缺少有关原生webrtc库的信息,所以我想添加)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.