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

Side by Side Diff: webrtc/media/engine/webrtcvoiceengine.cc

Issue 2774123002: Fix issue with conflicting behavior if setting a max BW with b=AS on both audio and video. (Closed)
Patch Set: Comment addressed Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1631 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 1631 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
1632 LOG(LS_INFO) << "WebRtcVoiceMediaChannel::SetSendParameters: " 1632 LOG(LS_INFO) << "WebRtcVoiceMediaChannel::SetSendParameters: "
1633 << params.ToString(); 1633 << params.ToString();
1634 // TODO(pthatcher): Refactor this to be more clean now that we have 1634 // TODO(pthatcher): Refactor this to be more clean now that we have
1635 // all the information at once. 1635 // all the information at once.
1636 1636
1637 if (!SetSendCodecs(params.codecs)) { 1637 if (!SetSendCodecs(params.codecs)) {
1638 return false; 1638 return false;
1639 } 1639 }
1640 1640
1641 if (params.max_bandwidth_bps >= 0) {
1642 // Note that max_bandwidth_bps intentionally takes priority over the
1643 // bitrate config for the codec.
1644 bitrate_config_.max_bitrate_bps =
1645 params.max_bandwidth_bps == 0 ? -1 : params.max_bandwidth_bps;
1646 }
1647 call_->SetBitrateConfig(bitrate_config_);
1648
1649 if (!ValidateRtpExtensions(params.extensions)) { 1641 if (!ValidateRtpExtensions(params.extensions)) {
1650 return false; 1642 return false;
1651 } 1643 }
1652 std::vector<webrtc::RtpExtension> filtered_extensions = 1644 std::vector<webrtc::RtpExtension> filtered_extensions =
1653 FilterRtpExtensions(params.extensions, 1645 FilterRtpExtensions(params.extensions,
1654 webrtc::RtpExtension::IsSupportedForAudio, true); 1646 webrtc::RtpExtension::IsSupportedForAudio, true);
1655 if (send_rtp_extensions_ != filtered_extensions) { 1647 if (send_rtp_extensions_ != filtered_extensions) {
1656 send_rtp_extensions_.swap(filtered_extensions); 1648 send_rtp_extensions_.swap(filtered_extensions);
1657 for (auto& it : send_streams_) { 1649 for (auto& it : send_streams_) {
1658 it.second->RecreateAudioSendStream(send_rtp_extensions_); 1650 it.second->RecreateAudioSendStream(send_rtp_extensions_);
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 dtmf_payload_freq_ = codec.clockrate; 1902 dtmf_payload_freq_ = codec.clockrate;
1911 } 1903 }
1912 } 1904 }
1913 } 1905 }
1914 1906
1915 // Scan through the list to figure out the codec to use for sending, along 1907 // Scan through the list to figure out the codec to use for sending, along
1916 // with the proper configuration for VAD, CNG, NACK and Opus-specific 1908 // with the proper configuration for VAD, CNG, NACK and Opus-specific
1917 // parameters. 1909 // parameters.
1918 // TODO(solenberg): Refactor this logic once we create AudioEncoders here. 1910 // TODO(solenberg): Refactor this logic once we create AudioEncoders here.
1919 webrtc::AudioSendStream::Config::SendCodecSpec send_codec_spec; 1911 webrtc::AudioSendStream::Config::SendCodecSpec send_codec_spec;
1912 webrtc::Call::Config::BitrateConfig bitrate_config;
1920 { 1913 {
1921 send_codec_spec.nack_enabled = send_codec_spec_.nack_enabled; 1914 send_codec_spec.nack_enabled = send_codec_spec_.nack_enabled;
1922 1915
1923 // Find send codec (the first non-telephone-event/CN codec). 1916 // Find send codec (the first non-telephone-event/CN codec).
1924 const AudioCodec* codec = WebRtcVoiceCodecs::GetPreferredCodec( 1917 const AudioCodec* codec = WebRtcVoiceCodecs::GetPreferredCodec(
1925 codecs, &send_codec_spec.codec_inst); 1918 codecs, &send_codec_spec.codec_inst);
1926 if (!codec) { 1919 if (!codec) {
1927 LOG(LS_WARNING) << "Received empty list of codecs."; 1920 LOG(LS_WARNING) << "Received empty list of codecs.";
1928 return false; 1921 return false;
1929 } 1922 }
1930 1923
1931 send_codec_spec.transport_cc_enabled = HasTransportCc(*codec); 1924 send_codec_spec.transport_cc_enabled = HasTransportCc(*codec);
1932 send_codec_spec.nack_enabled = HasNack(*codec); 1925 send_codec_spec.nack_enabled = HasNack(*codec);
1933 bitrate_config_ = GetBitrateConfigForCodec(*codec); 1926 bitrate_config = GetBitrateConfigForCodec(*codec);
1934 1927
1935 // For Opus as the send codec, we are to determine inband FEC, maximum 1928 // For Opus as the send codec, we are to determine inband FEC, maximum
1936 // playback rate, and opus internal dtx. 1929 // playback rate, and opus internal dtx.
1937 if (IsCodec(*codec, kOpusCodecName)) { 1930 if (IsCodec(*codec, kOpusCodecName)) {
1938 GetOpusConfig(*codec, &send_codec_spec.codec_inst, 1931 GetOpusConfig(*codec, &send_codec_spec.codec_inst,
1939 &send_codec_spec.enable_codec_fec, 1932 &send_codec_spec.enable_codec_fec,
1940 &send_codec_spec.opus_max_playback_rate, 1933 &send_codec_spec.opus_max_playback_rate,
1941 &send_codec_spec.enable_opus_dtx, 1934 &send_codec_spec.enable_opus_dtx,
1942 &send_codec_spec.min_ptime_ms, 1935 &send_codec_spec.min_ptime_ms,
1943 &send_codec_spec.max_ptime_ms); 1936 &send_codec_spec.max_ptime_ms);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2000 1993
2001 if (send_codec_spec_ != send_codec_spec) { 1994 if (send_codec_spec_ != send_codec_spec) {
2002 send_codec_spec_ = std::move(send_codec_spec); 1995 send_codec_spec_ = std::move(send_codec_spec);
2003 // Apply new settings to all streams. 1996 // Apply new settings to all streams.
2004 for (const auto& kv : send_streams_) { 1997 for (const auto& kv : send_streams_) {
2005 kv.second->RecreateAudioSendStream(send_codec_spec_); 1998 kv.second->RecreateAudioSendStream(send_codec_spec_);
2006 } 1999 }
2007 } else { 2000 } else {
2008 // If the codec isn't changing, set the start bitrate to -1 which means 2001 // If the codec isn't changing, set the start bitrate to -1 which means
2009 // "unchanged" so that BWE isn't affected. 2002 // "unchanged" so that BWE isn't affected.
2010 bitrate_config_.start_bitrate_bps = -1; 2003 bitrate_config.start_bitrate_bps = -1;
2011 } 2004 }
2005 call_->SetBitrateConfig(bitrate_config);
2012 2006
2013 // Check if the transport cc feedback or NACK status has changed on the 2007 // Check if the transport cc feedback or NACK status has changed on the
2014 // preferred send codec, and in that case reconfigure all receive streams. 2008 // preferred send codec, and in that case reconfigure all receive streams.
2015 if (recv_transport_cc_enabled_ != send_codec_spec_.transport_cc_enabled || 2009 if (recv_transport_cc_enabled_ != send_codec_spec_.transport_cc_enabled ||
2016 recv_nack_enabled_ != send_codec_spec_.nack_enabled) { 2010 recv_nack_enabled_ != send_codec_spec_.nack_enabled) {
2017 LOG(LS_INFO) << "Recreate all the receive streams because the send " 2011 LOG(LS_INFO) << "Recreate all the receive streams because the send "
2018 "codec has changed."; 2012 "codec has changed.";
2019 recv_transport_cc_enabled_ = send_codec_spec_.transport_cc_enabled; 2013 recv_transport_cc_enabled_ = send_codec_spec_.transport_cc_enabled;
2020 recv_nack_enabled_ = send_codec_spec_.nack_enabled; 2014 recv_nack_enabled_ = send_codec_spec_.nack_enabled;
2021 for (auto& kv : recv_streams_) { 2015 for (auto& kv : recv_streams_) {
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
2654 ssrc); 2648 ssrc);
2655 if (it != unsignaled_recv_ssrcs_.end()) { 2649 if (it != unsignaled_recv_ssrcs_.end()) {
2656 unsignaled_recv_ssrcs_.erase(it); 2650 unsignaled_recv_ssrcs_.erase(it);
2657 return true; 2651 return true;
2658 } 2652 }
2659 return false; 2653 return false;
2660 } 2654 }
2661 } // namespace cricket 2655 } // namespace cricket
2662 2656
2663 #endif // HAVE_WEBRTC_VOICE 2657 #endif // HAVE_WEBRTC_VOICE
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.h ('k') | webrtc/media/engine/webrtcvoiceengine_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698