Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 webrtc::H264Decoder::IsSupported(); | 159 webrtc::H264Decoder::IsSupported(); |
| 160 } | 160 } |
| 161 return false; | 161 return false; |
| 162 } | 162 } |
| 163 | 163 |
| 164 void AddDefaultFeedbackParams(VideoCodec* codec) { | 164 void AddDefaultFeedbackParams(VideoCodec* codec) { |
| 165 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamCcm, kRtcpFbCcmParamFir)); | 165 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamCcm, kRtcpFbCcmParamFir)); |
| 166 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kParamValueEmpty)); | 166 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kParamValueEmpty)); |
| 167 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kRtcpFbNackParamPli)); | 167 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamNack, kRtcpFbNackParamPli)); |
| 168 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamRemb, kParamValueEmpty)); | 168 codec->AddFeedbackParam(FeedbackParam(kRtcpFbParamRemb, kParamValueEmpty)); |
| 169 codec->AddFeedbackParam( | |
| 170 FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty)); | |
| 169 } | 171 } |
| 170 | 172 |
| 171 static VideoCodec MakeVideoCodecWithDefaultFeedbackParams(int payload_type, | 173 static VideoCodec MakeVideoCodecWithDefaultFeedbackParams(int payload_type, |
| 172 const char* name) { | 174 const char* name) { |
| 173 VideoCodec codec(payload_type, name, kDefaultVideoMaxWidth, | 175 VideoCodec codec(payload_type, name, kDefaultVideoMaxWidth, |
| 174 kDefaultVideoMaxHeight, kDefaultVideoMaxFramerate, 0); | 176 kDefaultVideoMaxHeight, kDefaultVideoMaxFramerate, 0); |
| 175 AddDefaultFeedbackParams(&codec); | 177 AddDefaultFeedbackParams(&codec); |
| 176 return codec; | 178 return codec; |
| 177 } | 179 } |
| 178 | 180 |
| (...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 963 send_codec_ = rtc::Optional<WebRtcVideoChannel2::VideoCodecSettings>( | 965 send_codec_ = rtc::Optional<WebRtcVideoChannel2::VideoCodecSettings>( |
| 964 supported_codecs.front()); | 966 supported_codecs.front()); |
| 965 | 967 |
| 966 rtc::CritScope stream_lock(&stream_crit_); | 968 rtc::CritScope stream_lock(&stream_crit_); |
| 967 LOG(LS_INFO) << "Change the send codec because SetSendCodecs has a different " | 969 LOG(LS_INFO) << "Change the send codec because SetSendCodecs has a different " |
| 968 "first supported codec."; | 970 "first supported codec."; |
| 969 for (auto& kv : send_streams_) { | 971 for (auto& kv : send_streams_) { |
| 970 RTC_DCHECK(kv.second != nullptr); | 972 RTC_DCHECK(kv.second != nullptr); |
| 971 kv.second->SetCodec(supported_codecs.front()); | 973 kv.second->SetCodec(supported_codecs.front()); |
| 972 } | 974 } |
| 973 LOG(LS_INFO) << "SetNackAndRemb on all the receive streams because the send " | 975 LOG(LS_INFO) |
| 974 "codec has changed."; | 976 << "SetFeedbackOptions on all the receive streams because the send " |
| 977 "codec has changed."; | |
| 975 for (auto& kv : receive_streams_) { | 978 for (auto& kv : receive_streams_) { |
| 976 RTC_DCHECK(kv.second != nullptr); | 979 RTC_DCHECK(kv.second != nullptr); |
| 977 kv.second->SetNackAndRemb(HasNack(supported_codecs.front().codec), | 980 kv.second->SetFeedbackOptions( |
| 978 HasRemb(supported_codecs.front().codec)); | 981 HasNack(supported_codecs.front().codec), |
| 982 HasRemb(supported_codecs.front().codec), | |
| 983 HasTransportCcFeedback(supported_codecs.front().codec)); | |
| 979 } | 984 } |
| 980 | 985 |
| 981 // TODO(holmer): Changing the codec parameters shouldn't necessarily mean that | 986 // TODO(holmer): Changing the codec parameters shouldn't necessarily mean that |
| 982 // we change the min/max of bandwidth estimation. Reevaluate this. | 987 // we change the min/max of bandwidth estimation. Reevaluate this. |
| 983 VideoCodec codec = supported_codecs.front().codec; | 988 VideoCodec codec = supported_codecs.front().codec; |
| 984 int bitrate_kbps; | 989 int bitrate_kbps; |
| 985 if (codec.GetParam(kCodecParamMinBitrate, &bitrate_kbps) && | 990 if (codec.GetParam(kCodecParamMinBitrate, &bitrate_kbps) && |
| 986 bitrate_kbps > 0) { | 991 bitrate_kbps > 0) { |
| 987 bitrate_config_.min_bitrate_bps = bitrate_kbps * 1000; | 992 bitrate_config_.min_bitrate_bps = bitrate_kbps * 1000; |
| 988 } else { | 993 } else { |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1218 for (uint32_t used_ssrc : sp.ssrcs) | 1223 for (uint32_t used_ssrc : sp.ssrcs) |
| 1219 receive_ssrcs_.insert(used_ssrc); | 1224 receive_ssrcs_.insert(used_ssrc); |
| 1220 | 1225 |
| 1221 webrtc::VideoReceiveStream::Config config(this); | 1226 webrtc::VideoReceiveStream::Config config(this); |
| 1222 ConfigureReceiverRtp(&config, sp); | 1227 ConfigureReceiverRtp(&config, sp); |
| 1223 | 1228 |
| 1224 // Set up A/V sync group based on sync label. | 1229 // Set up A/V sync group based on sync label. |
| 1225 config.sync_group = sp.sync_label; | 1230 config.sync_group = sp.sync_label; |
| 1226 | 1231 |
| 1227 config.rtp.remb = send_codec_ ? HasRemb(send_codec_->codec) : false; | 1232 config.rtp.remb = send_codec_ ? HasRemb(send_codec_->codec) : false; |
| 1233 config.rtp.transport_cc_feedback = | |
|
pthatcher
2015/11/19 00:19:20
transport_cc would be more consistent with other n
stefan-webrtc
2015/11/20 16:58:48
Done.
| |
| 1234 send_codec_ ? HasTransportCcFeedback(send_codec_->codec) : false; | |
| 1228 | 1235 |
| 1229 receive_streams_[ssrc] = new WebRtcVideoReceiveStream( | 1236 receive_streams_[ssrc] = new WebRtcVideoReceiveStream( |
| 1230 call_, sp, config, external_decoder_factory_, default_stream, | 1237 call_, sp, config, external_decoder_factory_, default_stream, |
| 1231 recv_codecs_); | 1238 recv_codecs_); |
| 1232 | 1239 |
| 1233 return true; | 1240 return true; |
| 1234 } | 1241 } |
| 1235 | 1242 |
| 1236 void WebRtcVideoChannel2::ConfigureReceiverRtp( | 1243 void WebRtcVideoChannel2::ConfigureReceiverRtp( |
| 1237 webrtc::VideoReceiveStream::Config* config, | 1244 webrtc::VideoReceiveStream::Config* config, |
| (...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2466 return; | 2473 return; |
| 2467 } | 2474 } |
| 2468 | 2475 |
| 2469 config_.rtp.local_ssrc = local_ssrc; | 2476 config_.rtp.local_ssrc = local_ssrc; |
| 2470 LOG(LS_INFO) | 2477 LOG(LS_INFO) |
| 2471 << "RecreateWebRtcStream (recv) because of SetLocalSsrc; local_ssrc=" | 2478 << "RecreateWebRtcStream (recv) because of SetLocalSsrc; local_ssrc=" |
| 2472 << local_ssrc; | 2479 << local_ssrc; |
| 2473 RecreateWebRtcStream(); | 2480 RecreateWebRtcStream(); |
| 2474 } | 2481 } |
| 2475 | 2482 |
| 2476 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetNackAndRemb( | 2483 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetFeedbackOptions( |
| 2477 bool nack_enabled, bool remb_enabled) { | 2484 bool nack_enabled, |
| 2485 bool remb_enabled, | |
| 2486 bool transport_cc_enabled) { | |
| 2478 int nack_history_ms = nack_enabled ? kNackHistoryMs : 0; | 2487 int nack_history_ms = nack_enabled ? kNackHistoryMs : 0; |
| 2479 if (config_.rtp.nack.rtp_history_ms == nack_history_ms && | 2488 if (config_.rtp.nack.rtp_history_ms == nack_history_ms && |
| 2480 config_.rtp.remb == remb_enabled) { | 2489 config_.rtp.remb == remb_enabled && |
| 2481 LOG(LS_INFO) << "Ignoring call to SetNackAndRemb because parameters are " | 2490 config_.rtp.transport_cc_feedback == transport_cc_enabled) { |
| 2482 "unchanged; nack=" << nack_enabled | 2491 LOG(LS_INFO) |
| 2483 << ", remb=" << remb_enabled; | 2492 << "Ignoring call to SetFeedbackOptions because parameters are " |
| 2493 "unchanged; nack=" | |
| 2494 << nack_enabled << ", remb=" << remb_enabled | |
| 2495 << ", transport_cc=" << transport_cc_enabled; | |
| 2484 return; | 2496 return; |
| 2485 } | 2497 } |
| 2486 config_.rtp.remb = remb_enabled; | 2498 config_.rtp.remb = remb_enabled; |
| 2487 config_.rtp.nack.rtp_history_ms = nack_history_ms; | 2499 config_.rtp.nack.rtp_history_ms = nack_history_ms; |
| 2488 LOG(LS_INFO) << "RecreateWebRtcStream (recv) because of SetNackAndRemb; nack=" | 2500 config_.rtp.transport_cc_feedback = transport_cc_enabled; |
| 2489 << nack_enabled << ", remb=" << remb_enabled; | 2501 LOG(LS_INFO) |
| 2502 << "RecreateWebRtcStream (recv) because of SetFeedbackOptions; nack=" | |
| 2503 << nack_enabled << ", remb=" << remb_enabled | |
| 2504 << ", transport_cc=" << transport_cc_enabled; | |
| 2490 RecreateWebRtcStream(); | 2505 RecreateWebRtcStream(); |
| 2491 } | 2506 } |
| 2492 | 2507 |
| 2493 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetRtpExtensions( | 2508 void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetRtpExtensions( |
| 2494 const std::vector<webrtc::RtpExtension>& extensions) { | 2509 const std::vector<webrtc::RtpExtension>& extensions) { |
| 2495 config_.rtp.extensions = extensions; | 2510 config_.rtp.extensions = extensions; |
| 2496 LOG(LS_INFO) << "RecreateWebRtcStream (recv) because of SetRtpExtensions"; | 2511 LOG(LS_INFO) << "RecreateWebRtcStream (recv) because of SetRtpExtensions"; |
| 2497 RecreateWebRtcStream(); | 2512 RecreateWebRtcStream(); |
| 2498 } | 2513 } |
| 2499 | 2514 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2742 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2757 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
| 2743 } | 2758 } |
| 2744 } | 2759 } |
| 2745 | 2760 |
| 2746 return video_codecs; | 2761 return video_codecs; |
| 2747 } | 2762 } |
| 2748 | 2763 |
| 2749 } // namespace cricket | 2764 } // namespace cricket |
| 2750 | 2765 |
| 2751 #endif // HAVE_WEBRTC_VIDEO | 2766 #endif // HAVE_WEBRTC_VIDEO |
| OLD | NEW |