Chromium Code Reviews| Index: webrtc/media/engine/webrtcvideoengine2.cc |
| diff --git a/webrtc/media/engine/webrtcvideoengine2.cc b/webrtc/media/engine/webrtcvideoengine2.cc |
| index 0e9866064df142cf7d1529065a818560a674dea3..33213af6d82a15824e679a887f59cc21d6df1dad 100644 |
| --- a/webrtc/media/engine/webrtcvideoengine2.cc |
| +++ b/webrtc/media/engine/webrtcvideoengine2.cc |
| @@ -790,17 +790,20 @@ bool WebRtcVideoChannel2::SetSendParameters(const VideoSendParameters& params) { |
| send_rtp_extensions_ = *changed_params.rtp_header_extensions; |
| } |
| + int max_global_bitrate = -1; |
|
Taylor Brandstetter
2016/03/12 01:57:06
This variable can remain inside the scoped block.
skvlad
2016/03/15 21:18:18
Good catch, thanks!
|
| if (changed_params.max_bandwidth_bps) { |
| // TODO(pbos): Figure out whether b=AS means max bitrate for this |
| // WebRtcVideoChannel2 (in which case we're good), or per sender (SSRC), in |
| // which case this should not set a Call::BitrateConfig but rather |
| // reconfigure all senders. |
| - int max_bitrate_bps = *changed_params.max_bandwidth_bps; |
| + max_global_bitrate = *changed_params.max_bandwidth_bps; |
| bitrate_config_.start_bitrate_bps = -1; |
| - bitrate_config_.max_bitrate_bps = max_bitrate_bps; |
| - if (max_bitrate_bps > 0 && |
| - bitrate_config_.min_bitrate_bps > max_bitrate_bps) { |
| - bitrate_config_.min_bitrate_bps = max_bitrate_bps; |
| + bitrate_config_.max_bitrate_bps = max_global_bitrate; |
| + if (max_global_bitrate > 0 && |
| + bitrate_config_.min_bitrate_bps > max_global_bitrate) { |
| + bitrate_config_.min_bitrate_bps = max_global_bitrate; |
| + // TODO(skvlad): limit min_bitrate_bps to not exceed the lowest of all |
|
pthatcher1
2016/03/12 01:21:04
limit => Limit
skvlad
2016/03/15 21:18:18
Done.
|
| + // per-SSRC bitrate limits |
|
pthatcher1
2016/03/12 01:21:04
Actually, pbos said that once we move to UnifiedPl
skvlad
2016/03/15 21:18:18
Done.
|
| } |
| bitrate_config_changed = true; |
| } |
| @@ -815,6 +818,11 @@ bool WebRtcVideoChannel2::SetSendParameters(const VideoSendParameters& params) { |
| { |
| rtc::CritScope stream_lock(&stream_crit_); |
| for (auto& kv : send_streams_) { |
| + if (changed_params.max_bandwidth_bps) { |
| + changed_params.max_bandwidth_bps = rtc::Optional<int>(MinPositive( |
| + max_global_bitrate, |
|
pthatcher1
2016/03/12 01:21:04
You could make max_global_bitrate rtc::Optional<in
skvlad
2016/03/15 21:18:18
rtc::Optional changes will come in a separate code
|
| + kv.second->rtp_parameters().encodings[0].max_bitrate_bps)); |
|
Taylor Brandstetter
2016/03/12 01:57:06
A problem with this is that even if the minimum of
pthatcher1
2016/03/14 16:26:50
Good point to avoid reconfiguration.
skvlad
2016/03/15 21:18:18
Added a TODO. I'll address this as part of the rtc
|
| + } |
|
pthatcher1
2016/03/12 01:21:03
Actually, I think this isn't necessary. If the pe
skvlad
2016/03/15 21:18:18
Looks like you are right: the global minimum bitra
|
| kv.second->SetSendParameters(changed_params); |
| } |
| if (changed_params.codec) { |
| @@ -833,6 +841,43 @@ bool WebRtcVideoChannel2::SetSendParameters(const VideoSendParameters& params) { |
| send_params_ = params; |
| return true; |
| } |
| +webrtc::RTCRtpParameters WebRtcVideoChannel2::GetRtpParameters(uint32_t ssrc) { |
| + rtc::CritScope stream_lock(&stream_crit_); |
| + auto it = send_streams_.find(ssrc); |
| + if (it == send_streams_.end()) { |
| + LOG(LS_WARNING) << "Attempting to get RTP parameters for stream with ssrc " |
| + << ssrc << " which doesn't exist."; |
| + return webrtc::RTCRtpParameters(); |
| + } |
| + |
| + return it->second->rtp_parameters(); |
| +} |
| + |
| +bool WebRtcVideoChannel2::SetRtpParameters( |
| + uint32_t ssrc, |
| + const webrtc::RTCRtpParameters& parameters) { |
| + rtc::CritScope stream_lock(&stream_crit_); |
| + auto it = send_streams_.find(ssrc); |
| + if (it == send_streams_.end()) { |
| + LOG(LS_WARNING) << "Attempting to set RTP parameters for stream with ssrc " |
| + << ssrc << " which doesn't exist."; |
| + return false; |
| + } |
| + |
| + if (parameters.encodings.size() != 1) { |
| + LOG(LS_WARNING) |
| + << "Attempting to set RTP parameters without exactly 1 encoding"; |
| + return false; |
| + } |
| + |
| + it->second->set_rtp_parameters(parameters); |
|
pthatcher1
2016/03/12 01:21:03
I think we should have a SetRtpParameters on the s
Taylor Brandstetter
2016/03/12 01:57:06
I would say the same thing, but the send stream do
pthatcher1
2016/03/14 16:26:50
I think adding a new state variable to the SendStr
|
| + ChangedSendParameters changed_params; |
| + changed_params.max_bandwidth_bps = |
| + rtc::Optional<int>(MinPositive(bitrate_config_.max_bitrate_bps, |
|
pthatcher1
2016/03/12 01:21:03
I don't think we need the min with bitrate_config_
Taylor Brandstetter
2016/03/12 01:57:06
It shouldn't be the last ChangedSendParameters, bu
|
| + parameters.encodings[0].max_bitrate_bps)); |
| + it->second->SetSendParameters(changed_params); |
| + return true; |
| +} |
| bool WebRtcVideoChannel2::GetChangedRecvParameters( |
| const VideoRecvParameters& params, |
| @@ -1493,7 +1538,8 @@ WebRtcVideoChannel2::WebRtcVideoSendStream::WebRtcVideoSendStream( |
| sending_(false), |
| muted_(false), |
| first_frame_timestamp_ms_(0), |
| - last_frame_timestamp_ms_(0) { |
| + last_frame_timestamp_ms_(0), |
| + rtp_parameters_(webrtc::RTCRtpParameters::CreateDefault()) { |
| parameters_.config.rtp.max_packet_size = kVideoMtu; |
| parameters_.conference_mode = send_params.conference_mode; |