jpen
jpen

Reputation: 2147

WebRTC - Recording audio stream into file from within C++ application

I am playing around with WebRTC's "..\trunk\talk\examples\peerconnection" sample.

I have modified "..\peerconnection\server\server_test.html" so it streams audio to "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.

How can I save this RTP packet stream into a file (.pcm format?) from within the receiving side?

Upvotes: 4

Views: 2245

Answers (1)

ZoolWay
ZoolWay

Reputation: 5505

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.

Also see here: Writing WebRTC (AudioTrackSinkInterface) raw audio to disc

(Yes, this question was old but the web lacks information about the native webrtc library so I wanted to add)

Upvotes: 3

Related Questions