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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 // Disable overloaded virtual function warning. TODO(magjed): Remove once | 141 // Disable overloaded virtual function warning. TODO(magjed): Remove once |
142 // http://crbug/webrtc/6402 is fixed. | 142 // http://crbug/webrtc/6402 is fixed. |
143 using cricket::WebRtcVideoEncoderFactory::CreateVideoEncoder; | 143 using cricket::WebRtcVideoEncoderFactory::CreateVideoEncoder; |
144 | 144 |
145 cricket::WebRtcVideoEncoderFactory* factory_; | 145 cricket::WebRtcVideoEncoderFactory* factory_; |
146 // A list of encoders that were created without being wrapped in a | 146 // A list of encoders that were created without being wrapped in a |
147 // SimulcastEncoderAdapter. | 147 // SimulcastEncoderAdapter. |
148 std::vector<webrtc::VideoEncoder*> non_simulcast_encoders_; | 148 std::vector<webrtc::VideoEncoder*> non_simulcast_encoders_; |
149 }; | 149 }; |
150 | 150 |
151 void AddDefaultFeedbackParams(VideoCodec* codec) { | 151 void AddDefaultMediaFeedbackParams(VideoCodec* codec) { |
152 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamCcm, kRtcpFbCcmParamFir)); | 152 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamCcm, kRtcpFbCcmParamFir)); |
153 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kParamValueEmpty)); | 153 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kParamValueEmpty)); |
154 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kRtcpFbNackParamPli)); | 154 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kRtcpFbNackParamPli)); |
155 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamRemb, kParamValueEmpty)); | 155 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamRemb, kParamValueEmpty)); |
156 codec->AddFeedbackParam( | 156 codec->AddFeedbackParam( |
157 FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty)); | 157 FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty)); |
158 } | 158 } |
159 | 159 |
160 void AddDefaultFlexfecFeedbackParams(VideoCodec* codec) { | |
161 codec->AddFeedbackParam( | |
162 FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty)); | |
stefan-webrtc
2017/01/10 11:38:56
I think you'd want to add remb here as well in cas
brandtr
2017/01/10 12:33:51
That's right. Done.
| |
163 } | |
164 | |
160 static std::string CodecVectorToString(const std::vector<VideoCodec>& codecs) { | 165 static std::string CodecVectorToString(const std::vector<VideoCodec>& codecs) { |
161 std::stringstream out; | 166 std::stringstream out; |
162 out << '{'; | 167 out << '{'; |
163 for (size_t i = 0; i < codecs.size(); ++i) { | 168 for (size_t i = 0; i < codecs.size(); ++i) { |
164 out << codecs[i].ToString(); | 169 out << codecs[i].ToString(); |
165 if (i != codecs.size() - 1) { | 170 if (i != codecs.size() - 1) { |
166 out << ", "; | 171 out << ", "; |
167 } | 172 } |
168 } | 173 } |
169 out << '}'; | 174 out << '}'; |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
563 if (!is_payload_used[i - kFirstDynamicPayloadType]) | 568 if (!is_payload_used[i - kFirstDynamicPayloadType]) |
564 return rtc::Optional<int>(i); | 569 return rtc::Optional<int>(i); |
565 } | 570 } |
566 // No free payload type. | 571 // No free payload type. |
567 return rtc::Optional<int>(); | 572 return rtc::Optional<int>(); |
568 } | 573 } |
569 | 574 |
570 // This is a helper function for GetSupportedCodecs below. It will append new | 575 // This is a helper function for GetSupportedCodecs below. It will append new |
571 // unique codecs from |input_codecs| to |unified_codecs|. It will add default | 576 // unique codecs from |input_codecs| to |unified_codecs|. It will add default |
572 // feedback params to the codecs and will also add an associated RTX codec for | 577 // feedback params to the codecs and will also add an associated RTX codec for |
573 // recognized codecs (VP8, VP9, H264, and Red). | 578 // recognized codecs (VP8, VP9, H264, and RED). |
574 static void AppendVideoCodecs(const std::vector<VideoCodec>& input_codecs, | 579 static void AppendVideoCodecs(const std::vector<VideoCodec>& input_codecs, |
575 std::vector<VideoCodec>* unified_codecs) { | 580 std::vector<VideoCodec>* unified_codecs) { |
576 for (VideoCodec codec : input_codecs) { | 581 for (VideoCodec codec : input_codecs) { |
577 const rtc::Optional<int> payload_type = | 582 const rtc::Optional<int> payload_type = |
578 NextFreePayloadType(*unified_codecs); | 583 NextFreePayloadType(*unified_codecs); |
579 if (!payload_type) | 584 if (!payload_type) |
580 return; | 585 return; |
581 codec.id = *payload_type; | 586 codec.id = *payload_type; |
582 // TODO(magjed): Move the responsibility of setting these parameters to the | 587 // TODO(magjed): Move the responsibility of setting these parameters to the |
583 // encoder factories instead. | 588 // encoder factories instead. |
584 if (codec.name != kRedCodecName && codec.name != kUlpfecCodecName) | 589 if (codec.name != kRedCodecName && codec.name != kUlpfecCodecName && |
585 AddDefaultFeedbackParams(&codec); | 590 codec.name != kFlexfecCodecName) { |
591 AddDefaultMediaFeedbackParams(&codec); | |
592 } else if (codec.name == kFlexfecCodecName) { | |
593 AddDefaultFlexfecFeedbackParams(&codec); | |
magjed_webrtc
2017/01/10 10:46:57
Like the TODO above says, we eventually want this
brandtr
2017/01/10 12:33:51
Right, should have looked more carefully. Done.
| |
594 } | |
586 // Don't add same codec twice. | 595 // Don't add same codec twice. |
587 if (FindMatchingCodec(*unified_codecs, codec)) | 596 if (FindMatchingCodec(*unified_codecs, codec)) |
588 continue; | 597 continue; |
589 | 598 |
590 unified_codecs->push_back(codec); | 599 unified_codecs->push_back(codec); |
591 | 600 |
592 // Add associated RTX codec for recognized codecs. | 601 // Add associated RTX codec for recognized codecs. |
593 // TODO(deadbeef): Should we add RTX codecs for external codecs whose names | 602 // TODO(deadbeef): Should we add RTX codecs for external codecs whose names |
594 // we don't recognize? | 603 // we don't recognize? |
595 if (CodecNamesEq(codec.name, kVp8CodecName) || | 604 if (CodecNamesEq(codec.name, kVp8CodecName) || |
(...skipping 1989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2585 rtx_mapping[video_codecs[i].codec.id] != | 2594 rtx_mapping[video_codecs[i].codec.id] != |
2586 ulpfec_config.red_payload_type) { | 2595 ulpfec_config.red_payload_type) { |
2587 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2596 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
2588 } | 2597 } |
2589 } | 2598 } |
2590 | 2599 |
2591 return video_codecs; | 2600 return video_codecs; |
2592 } | 2601 } |
2593 | 2602 |
2594 } // namespace cricket | 2603 } // namespace cricket |
OLD | NEW |