Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1203)

Unified Diff: webrtc/media/engine/webrtcvoiceengine.cc

Issue 2123923004: Updated AudioDecoderFactory to list AudioCodecSpecs instead of SdpAudioFormats. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@audio-decoder-factory-usage
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/media/engine/webrtcvoiceengine.cc
diff --git a/webrtc/media/engine/webrtcvoiceengine.cc b/webrtc/media/engine/webrtcvoiceengine.cc
index efa077fa516c2508e70d39657b057040db264ec6..5de9cefc5514d689e2d8e19b68c7bf37444c95ff 100644
--- a/webrtc/media/engine/webrtcvoiceengine.cc
+++ b/webrtc/media/engine/webrtcvoiceengine.cc
@@ -1083,8 +1083,8 @@ webrtc::AudioDeviceModule* WebRtcVoiceEngine::adm() {
AudioCodecs WebRtcVoiceEngine::CollectRecvCodecs() const {
PayloadTypeMapper mapper;
AudioCodecs out;
- const std::vector<webrtc::SdpAudioFormat>& formats =
- decoder_factory_->GetSupportedFormats();
+ const std::vector<webrtc::AudioCodecSpec>& specs =
+ decoder_factory_->GetSupportedDecoders();
// Only generate CN payload types for these clockrates
std::vector<int> cn_clockrates = { 8000, 16000, 32000 };
@@ -1098,32 +1098,31 @@ AudioCodecs WebRtcVoiceEngine::CollectRecvCodecs() const {
}
};
- for (const auto& format : formats) {
- rtc::Optional<AudioCodec> opt_codec = mapper.ToAudioCodec(format);
+ for (const auto& spec : specs) {
+ rtc::Optional<AudioCodec> opt_codec = mapper.ToAudioCodec(spec.format);
if (opt_codec) {
auto& codec = *opt_codec;
if (IsCodec(codec, kOpusCodecName)) {
- // TODO(ossu): Should we set this specifically for just this codec?
- // If not, this can be replaced with a call to map_format.
+ // TODO(ossu): Investigate if this can be replaced by a wildcard rtcp-fb
+ // param.
codec.AddFeedbackParam(
FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty));
}
out.push_back(codec);
- // TODO(ossu): We should get more than just a format from the factory, so
- // we can determine if a format should be used with CN or not. For now,
- // generate a CN entry for each supported clock rate also used by a format
- // supported by the factory.
- auto cn = std::find(cn_clockrates.begin(), cn_clockrates.end(),
- format.clockrate_hz);
- if (cn != cn_clockrates.end() /* && format.allow_comfort_noise */) {
- map_format({kCnCodecName, format.clockrate_hz, 1});
- *cn = cn_clockrates.back();
- cn_clockrates.pop_back();
+ if (spec.allow_comfort_noise) {
+ auto cn = std::find(cn_clockrates.begin(), cn_clockrates.end(),
+ spec.format.clockrate_hz);
+ if (cn != cn_clockrates.end()) {
+ map_format({kCnCodecName, spec.format.clockrate_hz, 1});
+ *cn = cn_clockrates.back();
+ cn_clockrates.pop_back();
+ }
}
} else {
- LOG(LS_ERROR) << "Unable to assign payload type to format: " << format;
+ LOG(LS_ERROR) << "Unable to assign payload type to format: "
+ << spec.format;
}
}

Powered by Google App Engine
This is Rietveld 408576698