Repository navigation
Conversation
PeerConnectionFactory.Builder gains setAudioEncoderFactory and setAudioDecoderFactory, which take the new BuiltinAudioEncoderFactory and BuiltinAudioDecoderFactory of dev.onvoid.webrtc.media.audio.codec. Without codec names they are WebRTC's built-in factories, as before. With names they offer only those codecs, in that order, for example only Opus; an unknown name throws and lists the built-in codecs. getSupportedCodecs() returns the resulting AudioCodecInfo list. Natively, FilteredAudioEncoderFactory and FilteredAudioDecoderFactory wrap the built-in factories, selecting and ordering by name the same way the Java side does, and refusing to create codecs that were not selected. WebRTC still adds telephone-event, CN and red by itself. The factory classes are abstract with package-private constructors, so that Java audio codecs can be added later without changing the builder.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The audio counterpart of the video codec factories (#303), as far as the Android SDK goes: Android's
setAudioEncoderFactoryFactory/setAudioDecoderFactoryFactoryonly take native factories, in practice the built-in ones. This lets aPeerConnectionFactorylimit and order WebRTC's built-in audio codecs; Java audio codecs are left out.API
New package
dev.onvoid.webrtc.media.audio.codec:BuiltinAudioEncoderFactory(String... codecNames)andBuiltinAudioDecoderFactory(String... codecNames): without names, all of WebRTC's built-in codecs (Opus, G722, PCMU, PCMA), as before. With names, only those codecs, in that order of preference. Names are compared ignoring case and de-duplicated; an unknown name throws anIllegalArgumentExceptionthat lists the built-in codecs.getSupportedCodecs()returns the resultingAudioCodecInfolist: name, clock rate, channels and format parameters.AudioEncoderFactory/AudioDecoderFactory: abstract classes with package-private constructors, so the built-in factories are their only implementations for now, while Java audio codecs could be added later without changing the builder.PeerConnectionFactory.BuildergainssetAudioEncoderFactory()andsetAudioDecoderFactory():WebRTC still adds the auxiliary codecs by itself, depending on the selected ones:
telephone-eventat the 8000 and 48000 Hz clock rates (so DTMF keeps working),CNnext to 8000 Hz codecs, andrednext to Opus. The javadoc and guide say so.Native
FilteredAudioEncoderFactory/FilteredAudioDecoderFactorywrap the built-in factories: they list the selected codecs ordered by name (AudioCodecSelection, the same algorithm as the Java side), and refuse to query or create the others.AudioCodecFactoriesbuilds the native factory from the Java object, reading its canonical codec names; no factory or no names means the built-in factory itself, unchanged.PeerConnectionFactory.initializetakes the two factories; the existing constructors passnull.media/audio/codec/, with its own glob inCMakeLists.txt.Docs
A new "Audio Codecs" guide (
docs/guide/advanced/audio-codecs.md), linked from the sidebar and the guide index.Tests
AudioCodecFactoryTests: the built-in list and Opus's clock rate and channels, ordering and case-insensitive de-duplication, unknown names, which codecs a factory's sender and receiver capabilities list (includingtelephone-event), the codec order of an actual offer, and a call that negotiates the only selected codec.The full
webrtcsuite passes on Windows (267 run, 0 failures, 2 skipped); before the rebase onto the currentmain, also under-Pjni-checkwith no JNI errors.