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

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

Issue 2534173002: Wire up x-google-{min,start,max}-bitrate to WebRtcVoiceMediaChannel. (Closed)
Patch Set: . Created 4 years 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 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after
1609 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 1609 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
1610 LOG(LS_INFO) << "WebRtcVoiceMediaChannel::SetSendParameters: " 1610 LOG(LS_INFO) << "WebRtcVoiceMediaChannel::SetSendParameters: "
1611 << params.ToString(); 1611 << params.ToString();
1612 // TODO(pthatcher): Refactor this to be more clean now that we have 1612 // TODO(pthatcher): Refactor this to be more clean now that we have
1613 // all the information at once. 1613 // all the information at once.
1614 1614
1615 if (!SetSendCodecs(params.codecs)) { 1615 if (!SetSendCodecs(params.codecs)) {
1616 return false; 1616 return false;
1617 } 1617 }
1618 1618
1619 if (params.max_bandwidth_bps >= 0) {
1620 // Note that max_bandwidth_bps intentionally takes priority over the
1621 // bitrate config for the codec.
1622 bitrate_config_.max_bitrate_bps =
1623 params.max_bandwidth_bps == 0 ? -1 : params.max_bandwidth_bps;
1624 }
1625 call_->SetBitrateConfig(bitrate_config_);
minyue-webrtc 2016/11/30 14:25:25 can we determine bitrate_config in one util functi
stefan-webrtc 2016/11/30 14:52:23 I don't know. It's probably doable, but it doesn't
1626
1619 if (!ValidateRtpExtensions(params.extensions)) { 1627 if (!ValidateRtpExtensions(params.extensions)) {
1620 return false; 1628 return false;
1621 } 1629 }
1622 std::vector<webrtc::RtpExtension> filtered_extensions = 1630 std::vector<webrtc::RtpExtension> filtered_extensions =
1623 FilterRtpExtensions(params.extensions, 1631 FilterRtpExtensions(params.extensions,
1624 webrtc::RtpExtension::IsSupportedForAudio, true); 1632 webrtc::RtpExtension::IsSupportedForAudio, true);
1625 if (send_rtp_extensions_ != filtered_extensions) { 1633 if (send_rtp_extensions_ != filtered_extensions) {
1626 send_rtp_extensions_.swap(filtered_extensions); 1634 send_rtp_extensions_.swap(filtered_extensions);
1627 for (auto& it : send_streams_) { 1635 for (auto& it : send_streams_) {
1628 it.second->RecreateAudioSendStream(send_rtp_extensions_); 1636 it.second->RecreateAudioSendStream(send_rtp_extensions_);
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 // Find send codec (the first non-telephone-event/CN codec). 1922 // Find send codec (the first non-telephone-event/CN codec).
1915 const AudioCodec* codec = WebRtcVoiceCodecs::GetPreferredCodec( 1923 const AudioCodec* codec = WebRtcVoiceCodecs::GetPreferredCodec(
1916 codecs, &send_codec_spec.codec_inst); 1924 codecs, &send_codec_spec.codec_inst);
1917 if (!codec) { 1925 if (!codec) {
1918 LOG(LS_WARNING) << "Received empty list of codecs."; 1926 LOG(LS_WARNING) << "Received empty list of codecs.";
1919 return false; 1927 return false;
1920 } 1928 }
1921 1929
1922 send_codec_spec.transport_cc_enabled = HasTransportCc(*codec); 1930 send_codec_spec.transport_cc_enabled = HasTransportCc(*codec);
1923 send_codec_spec.nack_enabled = HasNack(*codec); 1931 send_codec_spec.nack_enabled = HasNack(*codec);
1932 bitrate_config_ = GetBitrateConfigForCodec(*codec);
1924 1933
1925 // For Opus as the send codec, we are to determine inband FEC, maximum 1934 // For Opus as the send codec, we are to determine inband FEC, maximum
1926 // playback rate, and opus internal dtx. 1935 // playback rate, and opus internal dtx.
1927 if (IsCodec(*codec, kOpusCodecName)) { 1936 if (IsCodec(*codec, kOpusCodecName)) {
1928 GetOpusConfig(*codec, &send_codec_spec.codec_inst, 1937 GetOpusConfig(*codec, &send_codec_spec.codec_inst,
1929 &send_codec_spec.enable_codec_fec, 1938 &send_codec_spec.enable_codec_fec,
1930 &send_codec_spec.opus_max_playback_rate, 1939 &send_codec_spec.opus_max_playback_rate,
1931 &send_codec_spec.enable_opus_dtx, 1940 &send_codec_spec.enable_opus_dtx,
1932 &send_codec_spec.min_ptime_ms, 1941 &send_codec_spec.min_ptime_ms,
1933 &send_codec_spec.max_ptime_ms); 1942 &send_codec_spec.max_ptime_ms);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1980 // Find the telephone-event PT exactly matching the preferred send codec. 1989 // Find the telephone-event PT exactly matching the preferred send codec.
1981 for (const AudioCodec& dtmf_codec : dtmf_codecs) { 1990 for (const AudioCodec& dtmf_codec : dtmf_codecs) {
1982 if (dtmf_codec.clockrate == codec->clockrate) { 1991 if (dtmf_codec.clockrate == codec->clockrate) {
1983 dtmf_payload_type_ = rtc::Optional<int>(dtmf_codec.id); 1992 dtmf_payload_type_ = rtc::Optional<int>(dtmf_codec.id);
1984 dtmf_payload_freq_ = dtmf_codec.clockrate; 1993 dtmf_payload_freq_ = dtmf_codec.clockrate;
1985 break; 1994 break;
1986 } 1995 }
1987 } 1996 }
1988 } 1997 }
1989 1998
1990 // Apply new settings to all streams.
1991 if (send_codec_spec_ != send_codec_spec) { 1999 if (send_codec_spec_ != send_codec_spec) {
1992 send_codec_spec_ = std::move(send_codec_spec); 2000 send_codec_spec_ = std::move(send_codec_spec);
2001 // Apply new settings to all streams.
1993 for (const auto& kv : send_streams_) { 2002 for (const auto& kv : send_streams_) {
1994 kv.second->RecreateAudioSendStream(send_codec_spec_); 2003 kv.second->RecreateAudioSendStream(send_codec_spec_);
1995 } 2004 }
2005 } else {
2006 // If the codec isn't changing, set the start bitrate to -1 which means
2007 // "unchanged" so that BWE isn't affected.
2008 bitrate_config_.start_bitrate_bps = -1;
1996 } 2009 }
the sun 2016/11/30 13:55:51 If you move call_->SetBitrateConfig() here instead
stefan-webrtc 2016/11/30 14:15:30 It isn't that simple, since params.max_bandwidth_b
1997 2010
1998 // Check if the transport cc feedback or NACK status has changed on the 2011 // Check if the transport cc feedback or NACK status has changed on the
1999 // preferred send codec, and in that case reconfigure all receive streams. 2012 // preferred send codec, and in that case reconfigure all receive streams.
2000 if (recv_transport_cc_enabled_ != send_codec_spec_.transport_cc_enabled || 2013 if (recv_transport_cc_enabled_ != send_codec_spec_.transport_cc_enabled ||
2001 recv_nack_enabled_ != send_codec_spec_.nack_enabled) { 2014 recv_nack_enabled_ != send_codec_spec_.nack_enabled) {
2002 LOG(LS_INFO) << "Recreate all the receive streams because the send " 2015 LOG(LS_INFO) << "Recreate all the receive streams because the send "
2003 "codec has changed."; 2016 "codec has changed.";
2004 recv_transport_cc_enabled_ = send_codec_spec_.transport_cc_enabled; 2017 recv_transport_cc_enabled_ = send_codec_spec_.transport_cc_enabled;
2005 recv_nack_enabled_ = send_codec_spec_.nack_enabled; 2018 recv_nack_enabled_ = send_codec_spec_.nack_enabled;
2006 for (auto& kv : recv_streams_) { 2019 for (auto& kv : recv_streams_) {
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
2638 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 2651 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
2639 const auto it = send_streams_.find(ssrc); 2652 const auto it = send_streams_.find(ssrc);
2640 if (it != send_streams_.end()) { 2653 if (it != send_streams_.end()) {
2641 return it->second->channel(); 2654 return it->second->channel();
2642 } 2655 }
2643 return -1; 2656 return -1;
2644 } 2657 }
2645 } // namespace cricket 2658 } // namespace cricket
2646 2659
2647 #endif // HAVE_WEBRTC_VOICE 2660 #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