PSA: Current state of injectable audio codecs

574 views
Skip to first unread message

Karl Wiberg

unread,
Oct 24, 2017, 9:48:20 AM10/24/17
to discuss...@googlegroups.com

tl;dr: It is now possible for applications to support codecs that aren’t included in the WebRTC code base, and to omit support for codecs that are included.


(This isn’t a single recent change, but rather a summary of what a bunch of recent and not-so-recent changes add up to.)


As of M63, webrtc::CreatePeerConnectionFactory() accepts audio encoder and decoder factory arguments; WebRTC will use the supplied factories when creating audio encoder and decoder objects. The point is that the factories determine the set of supported codecs; it is now possible for applications to support codecs that aren’t included in the WebRTC code base, and to omit support for codecs that are included. In the near future, omitting support for a built-in codec will also mean that the final binary will not contain the code for that codec (bug 8396).


webrtc::CreatePeerConnectionFactory() still has overloads that don’t take audio codec factory arguments, but they will soon go away. Using them is equivalent to creating factories with webrtc::CreateBuiltinAudioEncoderFactory() and webrtc::CreateBuiltinAudioEncoderFactory() and passing them to the corresponding overload that does take audio codec factory arguments.


Encoder factory examples (decoders work just the same; just replace Encoder with Decoder):


// A factory with the same old set of codecs:

webrtc::CreateBuiltinAudioEncoderFactory()


// A factory that supports only Opus and G.711:

webrtc::CreateAudioEncoderFactory<webrtc::AudioEncoderOpus,

                                 webrtc::AudioEncoderG711>()


// A factory that supports a codec that isn’t part of the

// WebRTC code base, plus Opus and G.711:

webrtc::CreateAudioEncoderFactory<MyHomemadeAudioEncoder,

                                 webrtc::AudioEncoderOpus,

                                 webrtc::AudioEncoderG711>()


See also real-life examples in Chromium.


--
Karl Wiberg | Software Engineer | kwi...@google.com | +46 70 696 1024

Piasy Xu

unread,
Oct 25, 2017, 2:53:18 AM10/25/17
to discuss-webrtc
There is a bug of custom video encoder about thread check, although it was fixed by 5f5fc6845a670896faeac5d31825a71c8f770cf5, but this commit has not been cherry-picked into branch-heads/63.

See https://bugs.chromium.org/p/webrtc/issues/detail?id=7760#c61

在 2017年10月24日星期二 UTC+8下午9:48:20,Karl Wiberg写道:

Ashik Salim

unread,
Apr 13, 2018, 6:24:41 AM4/13/18
to discuss-webrtc
While trying the latest upstream, the codebase no longer includes default support for Audio decoders. How do I tell webrtc that I want the builtin audio decoders included?
Reply all
Reply to author
Forward
0 new messages