Fix so that codec max bitrate doesn't override.
Currently the codec specific max bitrate that is set in the SDP gets overridden by the value set with the "b=AS" attribute (WebRtcVideoChannel::SetSendParameters). But at the WebRtcVideoSendStream level it does the opposite - the codec specific max bitrate value overrides the values that could be set by RtpParameters or the "b=AS" value (in WebRtcVideoSendStream::CreateVideoEncoderConfig). This change updates the logic to be consistent with what happens at the WebRtcVideoChannel level, and allows the RtpParameter max bitrate to override the codec specific max bitrate. Bug: webrtc:8655 Change-Id: I3f0347cb7cffcfc577484231b061ab0712453e69 Reviewed-on: https://webrtc-review.googlesource.com/88520 Commit-Queue: Stefan Holmer <stefan@webrtc.org> Reviewed-by: Stefan Holmer <stefan@webrtc.org> Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23989}
This commit is contained in:
@ -1940,6 +1940,10 @@ WebRtcVideoChannel::WebRtcVideoSendStream::CreateVideoEncoderConfig(
|
||||
encoder_config.number_of_streams = 1;
|
||||
}
|
||||
|
||||
// parameters_.max_bitrate comes from the max bitrate set at the SDP
|
||||
// (m-section) level with the attribute "b=AS." Note that we override this
|
||||
// value below if the RtpParameters max bitrate set with
|
||||
// RtpSender::SetParameters has a lower value.
|
||||
int stream_max_bitrate = parameters_.max_bitrate_bps;
|
||||
// When simulcast is enabled (when there are multiple encodings),
|
||||
// encodings[i].max_bitrate_bps will be enforced by
|
||||
@ -1953,8 +1957,13 @@ WebRtcVideoChannel::WebRtcVideoSendStream::CreateVideoEncoderConfig(
|
||||
parameters_.max_bitrate_bps);
|
||||
}
|
||||
|
||||
// The codec max bitrate comes from the "x-google-max-bitrate" parameter
|
||||
// attribute set in the SDP for a specific codec. As done in
|
||||
// WebRtcVideoChannel::SetSendParameters, this value does not override the
|
||||
// stream max_bitrate set above.
|
||||
int codec_max_bitrate_kbps;
|
||||
if (codec.GetParam(kCodecParamMaxBitrate, &codec_max_bitrate_kbps)) {
|
||||
if (codec.GetParam(kCodecParamMaxBitrate, &codec_max_bitrate_kbps) &&
|
||||
stream_max_bitrate == -1) {
|
||||
stream_max_bitrate = codec_max_bitrate_kbps * 1000;
|
||||
}
|
||||
encoder_config.max_bitrate_bps = stream_max_bitrate;
|
||||
|
||||
Reference in New Issue
Block a user