OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamCcm, kRtcpFbCcmParamFir)); | 176 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamCcm, kRtcpFbCcmParamFir)); |
177 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kParamValueEmpty)); | 177 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kParamValueEmpty)); |
178 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kRtcpFbNackParamPli)); | 178 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kRtcpFbNackParamPli)); |
179 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamRemb, kParamValueEmpty)); | 179 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamRemb, kParamValueEmpty)); |
180 codec->AddFeedbackParam( | 180 codec->AddFeedbackParam( |
181 FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty)); | 181 FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty)); |
182 } | 182 } |
183 | 183 |
184 static VideoCodec MakeVideoCodecWithDefaultFeedbackParams(int payload_type, | 184 static VideoCodec MakeVideoCodecWithDefaultFeedbackParams(int payload_type, |
185 const char* name) { | 185 const char* name) { |
186 VideoCodec codec(payload_type, name, kDefaultVideoMaxWidth, | 186 VideoCodec codec(payload_type, name); |
187 kDefaultVideoMaxHeight, kDefaultVideoMaxFramerate); | |
188 AddDefaultFeedbackParams(&codec); | 187 AddDefaultFeedbackParams(&codec); |
189 return codec; | 188 return codec; |
190 } | 189 } |
191 | 190 |
192 static std::string CodecVectorToString(const std::vector<VideoCodec>& codecs) { | 191 static std::string CodecVectorToString(const std::vector<VideoCodec>& codecs) { |
193 std::stringstream out; | 192 std::stringstream out; |
194 out << '{'; | 193 out << '{'; |
195 for (size_t i = 0; i < codecs.size(); ++i) { | 194 for (size_t i = 0; i < codecs.size(); ++i) { |
196 out << codecs[i].ToString(); | 195 out << codecs[i].ToString(); |
197 if (i != codecs.size() - 1) { | 196 if (i != codecs.size() - 1) { |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 // we only support up to 8 external payload types. | 667 // we only support up to 8 external payload types. |
669 // TODO(deadbeef): mediasession.cc already has code to dynamically | 668 // TODO(deadbeef): mediasession.cc already has code to dynamically |
670 // determine a payload type. We should be able to just leave the payload | 669 // determine a payload type. We should be able to just leave the payload |
671 // type empty and let mediasession determine it. However, currently RTX | 670 // type empty and let mediasession determine it. However, currently RTX |
672 // codecs are associated to codecs by payload type, meaning we DO need | 671 // codecs are associated to codecs by payload type, meaning we DO need |
673 // to allocate unique payload types here. So to make this change we would | 672 // to allocate unique payload types here. So to make this change we would |
674 // need to make RTX codecs associated by name instead. | 673 // need to make RTX codecs associated by name instead. |
675 const int kExternalVideoPayloadTypeBase = 120; | 674 const int kExternalVideoPayloadTypeBase = 120; |
676 size_t payload_type = kExternalVideoPayloadTypeBase + i; | 675 size_t payload_type = kExternalVideoPayloadTypeBase + i; |
677 RTC_DCHECK(payload_type < 128); | 676 RTC_DCHECK(payload_type < 128); |
678 VideoCodec codec(static_cast<int>(payload_type), codecs[i].name, | 677 VideoCodec codec(static_cast<int>(payload_type), codecs[i].name); |
679 codecs[i].max_width, codecs[i].max_height, | |
680 codecs[i].max_fps); | |
681 | 678 |
682 AddDefaultFeedbackParams(&codec); | 679 AddDefaultFeedbackParams(&codec); |
683 AddCodecAndMaybeRtxCodec(codec, &supported_codecs); | 680 AddCodecAndMaybeRtxCodec(codec, &supported_codecs); |
684 } | 681 } |
685 LOG(LS_INFO) << "Supported codecs (incl. external codecs): " | 682 LOG(LS_INFO) << "Supported codecs (incl. external codecs): " |
686 << CodecVectorToString(supported_codecs); | 683 << CodecVectorToString(supported_codecs); |
687 LOG(LS_INFO) << "Codecs supported by the external encoder factory: " | 684 LOG(LS_INFO) << "Codecs supported by the external encoder factory: " |
688 << out.str(); | 685 << out.str(); |
689 return supported_codecs; | 686 return supported_codecs; |
690 } | 687 } |
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1999 parameters_.max_bitrate_bps); | 1996 parameters_.max_bitrate_bps); |
2000 | 1997 |
2001 int codec_max_bitrate_kbps; | 1998 int codec_max_bitrate_kbps; |
2002 if (codec.GetParam(kCodecParamMaxBitrate, &codec_max_bitrate_kbps)) { | 1999 if (codec.GetParam(kCodecParamMaxBitrate, &codec_max_bitrate_kbps)) { |
2003 stream_max_bitrate = codec_max_bitrate_kbps * 1000; | 2000 stream_max_bitrate = codec_max_bitrate_kbps * 1000; |
2004 } | 2001 } |
2005 encoder_config.max_bitrate_bps = stream_max_bitrate; | 2002 encoder_config.max_bitrate_bps = stream_max_bitrate; |
2006 | 2003 |
2007 int max_qp = kDefaultQpMax; | 2004 int max_qp = kDefaultQpMax; |
2008 codec.GetParam(kCodecParamMaxQuantization, &max_qp); | 2005 codec.GetParam(kCodecParamMaxQuantization, &max_qp); |
2009 int max_framerate = | |
2010 codec.framerate != 0 ? codec.framerate : kDefaultVideoMaxFramerate; | |
2011 | |
2012 encoder_config.video_stream_factory = | 2006 encoder_config.video_stream_factory = |
2013 new rtc::RefCountedObject<EncoderStreamFactory>( | 2007 new rtc::RefCountedObject<EncoderStreamFactory>( |
2014 codec.name, max_qp, max_framerate, is_screencast, | 2008 codec.name, max_qp, kDefaultVideoMaxFramerate, is_screencast, |
2015 parameters_.conference_mode); | 2009 parameters_.conference_mode); |
2016 return encoder_config; | 2010 return encoder_config; |
2017 } | 2011 } |
2018 | 2012 |
2019 void WebRtcVideoChannel2::WebRtcVideoSendStream::ReconfigureEncoder() { | 2013 void WebRtcVideoChannel2::WebRtcVideoSendStream::ReconfigureEncoder() { |
2020 RTC_DCHECK_RUN_ON(&thread_checker_); | 2014 RTC_DCHECK_RUN_ON(&thread_checker_); |
2021 if (!stream_) { | 2015 if (!stream_) { |
2022 // The webrtc::VideoSendStream |stream_|has not yet been created but other | 2016 // The webrtc::VideoSendStream |stream_|has not yet been created but other |
2023 // parameters has changed. | 2017 // parameters has changed. |
2024 return; | 2018 return; |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2696 rtx_mapping[video_codecs[i].codec.id] != | 2690 rtx_mapping[video_codecs[i].codec.id] != |
2697 ulpfec_config.red_payload_type) { | 2691 ulpfec_config.red_payload_type) { |
2698 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2692 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
2699 } | 2693 } |
2700 } | 2694 } |
2701 | 2695 |
2702 return video_codecs; | 2696 return video_codecs; |
2703 } | 2697 } |
2704 | 2698 |
2705 } // namespace cricket | 2699 } // namespace cricket |
OLD | NEW |