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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kParamValueEmpty)); | 173 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kParamValueEmpty)); |
174 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kRtcpFbNackParamPli)); | 174 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kRtcpFbNackParamPli)); |
175 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamRemb, kParamValueEmpty)); | 175 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamRemb, kParamValueEmpty)); |
176 codec->AddFeedbackParam( | 176 codec->AddFeedbackParam( |
177 FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty)); | 177 FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty)); |
178 } | 178 } |
179 | 179 |
180 static VideoCodec MakeVideoCodecWithDefaultFeedbackParams(int payload_type, | 180 static VideoCodec MakeVideoCodecWithDefaultFeedbackParams(int payload_type, |
181 const char* name) { | 181 const char* name) { |
182 VideoCodec codec(payload_type, name, kDefaultVideoMaxWidth, | 182 VideoCodec codec(payload_type, name, kDefaultVideoMaxWidth, |
183 kDefaultVideoMaxHeight, kDefaultVideoMaxFramerate, 0); | 183 kDefaultVideoMaxHeight, kDefaultVideoMaxFramerate); |
184 AddDefaultFeedbackParams(&codec); | 184 AddDefaultFeedbackParams(&codec); |
185 return codec; | 185 return codec; |
186 } | 186 } |
187 | 187 |
188 static std::string CodecVectorToString(const std::vector<VideoCodec>& codecs) { | 188 static std::string CodecVectorToString(const std::vector<VideoCodec>& codecs) { |
189 std::stringstream out; | 189 std::stringstream out; |
190 out << '{'; | 190 out << '{'; |
191 for (size_t i = 0; i < codecs.size(); ++i) { | 191 for (size_t i = 0; i < codecs.size(); ++i) { |
192 out << codecs[i].ToString(); | 192 out << codecs[i].ToString(); |
193 if (i != codecs.size() - 1) { | 193 if (i != codecs.size() - 1) { |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 // Don't add internally-supported codecs twice. | 639 // Don't add internally-supported codecs twice. |
640 if (CodecIsInternallySupported(codecs[i].name)) { | 640 if (CodecIsInternallySupported(codecs[i].name)) { |
641 continue; | 641 continue; |
642 } | 642 } |
643 | 643 |
644 // External video encoders are given payloads 120-127. This also means that | 644 // External video encoders are given payloads 120-127. This also means that |
645 // we only support up to 8 external payload types. | 645 // we only support up to 8 external payload types. |
646 const int kExternalVideoPayloadTypeBase = 120; | 646 const int kExternalVideoPayloadTypeBase = 120; |
647 size_t payload_type = kExternalVideoPayloadTypeBase + i; | 647 size_t payload_type = kExternalVideoPayloadTypeBase + i; |
648 RTC_DCHECK(payload_type < 128); | 648 RTC_DCHECK(payload_type < 128); |
649 VideoCodec codec(static_cast<int>(payload_type), | 649 VideoCodec codec(static_cast<int>(payload_type), codecs[i].name, |
650 codecs[i].name, | 650 codecs[i].max_width, codecs[i].max_height, |
651 codecs[i].max_width, | 651 codecs[i].max_fps); |
652 codecs[i].max_height, | |
653 codecs[i].max_fps, | |
654 0); | |
655 | 652 |
656 AddDefaultFeedbackParams(&codec); | 653 AddDefaultFeedbackParams(&codec); |
657 supported_codecs.push_back(codec); | 654 supported_codecs.push_back(codec); |
658 } | 655 } |
659 return supported_codecs; | 656 return supported_codecs; |
660 } | 657 } |
661 | 658 |
662 WebRtcVideoChannel2::WebRtcVideoChannel2( | 659 WebRtcVideoChannel2::WebRtcVideoChannel2( |
663 webrtc::Call* call, | 660 webrtc::Call* call, |
664 const MediaConfig& config, | 661 const MediaConfig& config, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 // to be recreates which causes a "blink" of black video. In order | 729 // to be recreates which causes a "blink" of black video. In order |
733 // to support munging the SDP in this way without recreating receive | 730 // to support munging the SDP in this way without recreating receive |
734 // streams, we ignore the order of the received codecs so that | 731 // streams, we ignore the order of the received codecs so that |
735 // changing the order doesn't cause this "blink". | 732 // changing the order doesn't cause this "blink". |
736 auto comparison = | 733 auto comparison = |
737 [](const VideoCodecSettings& codec1, const VideoCodecSettings& codec2) { | 734 [](const VideoCodecSettings& codec1, const VideoCodecSettings& codec2) { |
738 return codec1.codec.id > codec2.codec.id; | 735 return codec1.codec.id > codec2.codec.id; |
739 }; | 736 }; |
740 std::sort(before.begin(), before.end(), comparison); | 737 std::sort(before.begin(), before.end(), comparison); |
741 std::sort(after.begin(), after.end(), comparison); | 738 std::sort(after.begin(), after.end(), comparison); |
742 for (size_t i = 0; i < before.size(); ++i) { | 739 return before != after; |
743 // For the same reason that we sort the codecs, we also ignore the | |
744 // preference. We don't want a preference change on the receive | |
745 // side to cause recreation of the stream. | |
746 before[i].codec.preference = 0; | |
747 after[i].codec.preference = 0; | |
748 if (before[i] != after[i]) { | |
749 return true; | |
750 } | |
751 } | |
752 return false; | |
753 } | 740 } |
754 | 741 |
755 bool WebRtcVideoChannel2::GetChangedSendParameters( | 742 bool WebRtcVideoChannel2::GetChangedSendParameters( |
756 const VideoSendParameters& params, | 743 const VideoSendParameters& params, |
757 ChangedSendParameters* changed_params) const { | 744 ChangedSendParameters* changed_params) const { |
758 if (!ValidateCodecFormats(params.codecs) || | 745 if (!ValidateCodecFormats(params.codecs) || |
759 !ValidateRtpExtensions(params.extensions)) { | 746 !ValidateRtpExtensions(params.extensions)) { |
760 return false; | 747 return false; |
761 } | 748 } |
762 | 749 |
(...skipping 1814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2577 rtx_mapping[video_codecs[i].codec.id] != | 2564 rtx_mapping[video_codecs[i].codec.id] != |
2578 fec_settings.red_payload_type) { | 2565 fec_settings.red_payload_type) { |
2579 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2566 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
2580 } | 2567 } |
2581 } | 2568 } |
2582 | 2569 |
2583 return video_codecs; | 2570 return video_codecs; |
2584 } | 2571 } |
2585 | 2572 |
2586 } // namespace cricket | 2573 } // namespace cricket |
OLD | NEW |