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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kParamValueEmpty)); | 174 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kParamValueEmpty)); |
175 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kRtcpFbNackParamPli)); | 175 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kRtcpFbNackParamPli)); |
176 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamRemb, kParamValueEmpty)); | 176 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamRemb, kParamValueEmpty)); |
177 codec->AddFeedbackParam( | 177 codec->AddFeedbackParam( |
178 FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty)); | 178 FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty)); |
179 } | 179 } |
180 | 180 |
181 static VideoCodec MakeVideoCodecWithDefaultFeedbackParams(int payload_type, | 181 static VideoCodec MakeVideoCodecWithDefaultFeedbackParams(int payload_type, |
182 const char* name) { | 182 const char* name) { |
183 VideoCodec codec(payload_type, name, kDefaultVideoMaxWidth, | 183 VideoCodec codec(payload_type, name, kDefaultVideoMaxWidth, |
184 kDefaultVideoMaxHeight, kDefaultVideoMaxFramerate, 0); | 184 kDefaultVideoMaxHeight, kDefaultVideoMaxFramerate); |
185 AddDefaultFeedbackParams(&codec); | 185 AddDefaultFeedbackParams(&codec); |
186 return codec; | 186 return codec; |
187 } | 187 } |
188 | 188 |
189 static std::string CodecVectorToString(const std::vector<VideoCodec>& codecs) { | 189 static std::string CodecVectorToString(const std::vector<VideoCodec>& codecs) { |
190 std::stringstream out; | 190 std::stringstream out; |
191 out << '{'; | 191 out << '{'; |
192 for (size_t i = 0; i < codecs.size(); ++i) { | 192 for (size_t i = 0; i < codecs.size(); ++i) { |
193 out << codecs[i].ToString(); | 193 out << codecs[i].ToString(); |
194 if (i != codecs.size() - 1) { | 194 if (i != codecs.size() - 1) { |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 // Don't add internally-supported codecs twice. | 627 // Don't add internally-supported codecs twice. |
628 if (CodecIsInternallySupported(codecs[i].name)) { | 628 if (CodecIsInternallySupported(codecs[i].name)) { |
629 continue; | 629 continue; |
630 } | 630 } |
631 | 631 |
632 // External video encoders are given payloads 120-127. This also means that | 632 // External video encoders are given payloads 120-127. This also means that |
633 // we only support up to 8 external payload types. | 633 // we only support up to 8 external payload types. |
634 const int kExternalVideoPayloadTypeBase = 120; | 634 const int kExternalVideoPayloadTypeBase = 120; |
635 size_t payload_type = kExternalVideoPayloadTypeBase + i; | 635 size_t payload_type = kExternalVideoPayloadTypeBase + i; |
636 RTC_DCHECK(payload_type < 128); | 636 RTC_DCHECK(payload_type < 128); |
637 VideoCodec codec(static_cast<int>(payload_type), | 637 VideoCodec codec(static_cast<int>(payload_type), codecs[i].name, |
638 codecs[i].name, | 638 codecs[i].max_width, codecs[i].max_height, |
639 codecs[i].max_width, | 639 codecs[i].max_fps); |
640 codecs[i].max_height, | |
641 codecs[i].max_fps, | |
642 0); | |
643 | 640 |
644 AddDefaultFeedbackParams(&codec); | 641 AddDefaultFeedbackParams(&codec); |
645 supported_codecs.push_back(codec); | 642 supported_codecs.push_back(codec); |
646 } | 643 } |
647 return supported_codecs; | 644 return supported_codecs; |
648 } | 645 } |
649 | 646 |
650 WebRtcVideoChannel2::WebRtcVideoChannel2( | 647 WebRtcVideoChannel2::WebRtcVideoChannel2( |
651 webrtc::Call* call, | 648 webrtc::Call* call, |
652 const MediaConfig& config, | 649 const MediaConfig& config, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 // to be recreates which causes a "blink" of black video. In order | 717 // to be recreates which causes a "blink" of black video. In order |
721 // to support munging the SDP in this way without recreating receive | 718 // to support munging the SDP in this way without recreating receive |
722 // streams, we ignore the order of the received codecs so that | 719 // streams, we ignore the order of the received codecs so that |
723 // changing the order doesn't cause this "blink". | 720 // changing the order doesn't cause this "blink". |
724 auto comparison = | 721 auto comparison = |
725 [](const VideoCodecSettings& codec1, const VideoCodecSettings& codec2) { | 722 [](const VideoCodecSettings& codec1, const VideoCodecSettings& codec2) { |
726 return codec1.codec.id > codec2.codec.id; | 723 return codec1.codec.id > codec2.codec.id; |
727 }; | 724 }; |
728 std::sort(before.begin(), before.end(), comparison); | 725 std::sort(before.begin(), before.end(), comparison); |
729 std::sort(after.begin(), after.end(), comparison); | 726 std::sort(after.begin(), after.end(), comparison); |
730 for (size_t i = 0; i < before.size(); ++i) { | 727 return before != after; |
731 // For the same reason that we sort the codecs, we also ignore the | |
732 // preference. We don't want a preference change on the receive | |
733 // side to cause recreation of the stream. | |
734 before[i].codec.preference = 0; | |
735 after[i].codec.preference = 0; | |
736 if (before[i] != after[i]) { | |
737 return true; | |
738 } | |
739 } | |
740 return false; | |
741 } | 728 } |
742 | 729 |
743 bool WebRtcVideoChannel2::GetChangedSendParameters( | 730 bool WebRtcVideoChannel2::GetChangedSendParameters( |
744 const VideoSendParameters& params, | 731 const VideoSendParameters& params, |
745 ChangedSendParameters* changed_params) const { | 732 ChangedSendParameters* changed_params) const { |
746 if (!ValidateCodecFormats(params.codecs) || | 733 if (!ValidateCodecFormats(params.codecs) || |
747 !ValidateRtpExtensions(params.extensions)) { | 734 !ValidateRtpExtensions(params.extensions)) { |
748 return false; | 735 return false; |
749 } | 736 } |
750 | 737 |
(...skipping 1842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2593 rtx_mapping[video_codecs[i].codec.id] != | 2580 rtx_mapping[video_codecs[i].codec.id] != |
2594 fec_settings.red_payload_type) { | 2581 fec_settings.red_payload_type) { |
2595 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2582 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
2596 } | 2583 } |
2597 } | 2584 } |
2598 | 2585 |
2599 return video_codecs; | 2586 return video_codecs; |
2600 } | 2587 } |
2601 | 2588 |
2602 } // namespace cricket | 2589 } // namespace cricket |
OLD | NEW |