(Auto)update libjingle 78430441-> 78445452
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7522 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -3664,78 +3664,80 @@ bool WebRtcVideoMediaChannel::SetSendCodec(const webrtc::VideoCodec& codec) {
|
|||||||
|
|
||||||
bool WebRtcVideoMediaChannel::SetSendCodec(
|
bool WebRtcVideoMediaChannel::SetSendCodec(
|
||||||
WebRtcVideoChannelSendInfo* send_channel,
|
WebRtcVideoChannelSendInfo* send_channel,
|
||||||
const webrtc::VideoCodec& codec) {
|
const webrtc::VideoCodec& target) {
|
||||||
if (!send_channel) {
|
if (!send_channel) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
send_channel->SetAdaptFormat(
|
send_channel->SetAdaptFormat(
|
||||||
VideoFormatFromVieCodec(codec),
|
VideoFormatFromVieCodec(target),
|
||||||
WebRtcVideoChannelSendInfo::kAdaptFormatTypeCodec);
|
WebRtcVideoChannelSendInfo::kAdaptFormatTypeCodec);
|
||||||
|
|
||||||
const int channel_id = send_channel->channel_id();
|
const int channel_id = send_channel->channel_id();
|
||||||
// Make a copy of the codec
|
// Make a copy of the codec
|
||||||
webrtc::VideoCodec target_codec = codec;
|
webrtc::VideoCodec codec = target;
|
||||||
|
|
||||||
// Set the default number of temporal layers for VP8.
|
// Set the default number of temporal layers for VP8.
|
||||||
if (webrtc::kVideoCodecVP8 == codec.codecType) {
|
if (webrtc::kVideoCodecVP8 == codec.codecType) {
|
||||||
target_codec.codecSpecific.VP8.numberOfTemporalLayers =
|
codec.codecSpecific.VP8.numberOfTemporalLayers =
|
||||||
kDefaultNumberOfTemporalLayers;
|
kDefaultNumberOfTemporalLayers;
|
||||||
|
|
||||||
// Turn off the VP8 error resilience
|
// Turn off the VP8 error resilience
|
||||||
target_codec.codecSpecific.VP8.resilience = webrtc::kResilienceOff;
|
codec.codecSpecific.VP8.resilience = webrtc::kResilienceOff;
|
||||||
|
|
||||||
bool enable_denoising =
|
bool enable_denoising =
|
||||||
options_.video_noise_reduction.GetWithDefaultIfUnset(true);
|
options_.video_noise_reduction.GetWithDefaultIfUnset(true);
|
||||||
target_codec.codecSpecific.VP8.denoisingOn = enable_denoising;
|
codec.codecSpecific.VP8.denoisingOn = enable_denoising;
|
||||||
}
|
}
|
||||||
|
|
||||||
MaybeRegisterExternalEncoder(send_channel, target_codec);
|
MaybeRegisterExternalEncoder(send_channel, codec);
|
||||||
|
|
||||||
// TODO(pthatcher): We should rely on the adapter to adapt the
|
// TODO(pthatcher): We should rely on the adapter to adapt the
|
||||||
// resolution, and not do it here.
|
// resolution, and not do it here.
|
||||||
if (send_channel->adapt_format_set()) {
|
if (send_channel->adapt_format_set()) {
|
||||||
target_codec.width = send_channel->adapt_format().width;
|
codec.width = send_channel->adapt_format().width;
|
||||||
target_codec.height = send_channel->adapt_format().height;
|
codec.height = send_channel->adapt_format().height;
|
||||||
target_codec.maxFramerate = cricket::VideoFormat::IntervalToFps(
|
codec.maxFramerate = cricket::VideoFormat::IntervalToFps(
|
||||||
send_channel->adapt_format().interval);
|
send_channel->adapt_format().interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target_codec.width == 0 && target_codec.height == 0) {
|
if (codec.width == 0 && codec.height == 0) {
|
||||||
const uint32 ssrc = send_channel->stream_params().first_ssrc();
|
const uint32 ssrc = send_channel->stream_params().first_ssrc();
|
||||||
LOG(LS_INFO) << "0x0 resolution selected. Captured frames will be dropped "
|
LOG(LS_INFO) << "0x0 resolution selected. Captured frames will be dropped "
|
||||||
<< "for ssrc: " << ssrc << ".";
|
<< "for ssrc: " << ssrc << ".";
|
||||||
} else {
|
return true;
|
||||||
const StreamParams& sp = send_channel->stream_params();
|
}
|
||||||
SanitizeBitrates(channel_id, &target_codec);
|
|
||||||
webrtc::VideoCodec current_codec;
|
|
||||||
if (!engine()->vie()->codec()->GetSendCodec(channel_id, current_codec)) {
|
|
||||||
// Compare against existing configured send codec.
|
|
||||||
if (current_codec == target_codec) {
|
|
||||||
// Codec is already configured on channel. no need to apply.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (0 != engine()->vie()->codec()->SetSendCodec(channel_id, target_codec)) {
|
const StreamParams& sp = send_channel->stream_params();
|
||||||
LOG_RTCERR2(SetSendCodec, channel_id, target_codec.plName);
|
SanitizeBitrates(channel_id, &codec);
|
||||||
|
webrtc::VideoCodec current_codec;
|
||||||
|
if (!engine()->vie()->codec()->GetSendCodec(channel_id, current_codec)) {
|
||||||
|
// Compare against existing configured send codec.
|
||||||
|
if (current_codec == codec) {
|
||||||
|
// Codec is already configured on channel. no need to apply.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 != engine()->vie()->codec()->SetSendCodec(channel_id, codec)) {
|
||||||
|
LOG_RTCERR2(SetSendCodec, channel_id, codec.plName);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (send_channel->IsActive()) {
|
||||||
|
if (!SetSendSsrcs(channel_id, sp, codec)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (send_channel->IsActive()) {
|
// NOTE: SetRtxSendPayloadType must be called after all simulcast SSRCs
|
||||||
if (!SetSendSsrcs(channel_id, sp, target_codec)) {
|
// are configured. Otherwise ssrc's configured after this point will use
|
||||||
return false;
|
// the primary PT for RTX.
|
||||||
}
|
if (send_rtx_type_ != -1 &&
|
||||||
}
|
engine()->vie()->rtp()->SetRtxSendPayloadType(channel_id,
|
||||||
// NOTE: SetRtxSendPayloadType must be called after all simulcast SSRCs
|
send_rtx_type_) != 0) {
|
||||||
// are configured. Otherwise ssrc's configured after this point will use
|
LOG_RTCERR2(SetRtxSendPayloadType, channel_id, send_rtx_type_);
|
||||||
// the primary PT for RTX.
|
return false;
|
||||||
if (send_rtx_type_ != -1 &&
|
|
||||||
engine()->vie()->rtp()->SetRtxSendPayloadType(channel_id,
|
|
||||||
send_rtx_type_) != 0) {
|
|
||||||
LOG_RTCERR2(SetRtxSendPayloadType, channel_id, send_rtx_type_);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -3926,24 +3928,18 @@ bool WebRtcVideoMediaChannel::SetSendParams(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
webrtc::VideoCodec target_codec = *send_codec_;
|
// TODO(pthatcher): This is only needed because some unit tests
|
||||||
// TODO(pthatcher): We should rely on the adapter to adapt the
|
// bypass the VideoAdapter, and others expect behavior from the
|
||||||
// resolution, and not do it here.
|
// adapter different than what it actually does. We should fix the
|
||||||
if (send_channel->adapt_format_set()) {
|
// tests and remove this.
|
||||||
target_codec.width = send_channel->adapt_format().width;
|
int frame_width = static_cast<int>(frame.width);
|
||||||
target_codec.height = send_channel->adapt_format().height;
|
int frame_height = static_cast<int>(frame.height);
|
||||||
target_codec.maxFramerate = cricket::VideoFormat::IntervalToFps(
|
if (!frame.screencast && send_channel->adapt_format_set()) {
|
||||||
send_channel->adapt_format().interval);
|
VideoFormat max = send_channel->adapt_format();
|
||||||
}
|
if (frame_width > max.width || frame_height > max.height) {
|
||||||
|
frame_width = max.width;
|
||||||
// Vie send codec size should not exceed target_codec.
|
frame_height = max.height;
|
||||||
int target_width = static_cast<int>(frame.width);
|
}
|
||||||
int target_height = static_cast<int>(frame.height);
|
|
||||||
if (!frame.screencast &&
|
|
||||||
(target_width > target_codec.width ||
|
|
||||||
target_height > target_codec.height)) {
|
|
||||||
target_width = target_codec.width;
|
|
||||||
target_height = target_codec.height;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get current vie codec.
|
// Get current vie codec.
|
||||||
@@ -3954,49 +3950,45 @@ bool WebRtcVideoMediaChannel::SetSendParams(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only reset send codec when there is a size change. Additionally,
|
|
||||||
// automatic resize needs to be turned off when screencasting and on when
|
|
||||||
// not screencasting.
|
|
||||||
// Don't allow automatic resizing for screencasting.
|
|
||||||
bool automatic_resize = !frame.screencast;
|
|
||||||
// Turn off VP8 frame dropping when screensharing as the current model does
|
|
||||||
// not work well at low fps.
|
|
||||||
bool vp8_frame_dropping = !frame.screencast;
|
|
||||||
// TODO(pbos): Remove |video_noise_reduction| and enable it for all
|
|
||||||
// non-screencast.
|
|
||||||
bool enable_denoising =
|
|
||||||
options_.video_noise_reduction.GetWithDefaultIfUnset(true);
|
|
||||||
// Disable denoising for screencasting.
|
|
||||||
if (frame.screencast) {
|
|
||||||
enable_denoising = false;
|
|
||||||
}
|
|
||||||
int screencast_min_bitrate =
|
|
||||||
options_.screencast_min_bitrate.GetWithDefaultIfUnset(0);
|
|
||||||
|
|
||||||
// Set the new codec on vie.
|
// Set the new codec on vie.
|
||||||
webrtc::VideoCodec vie_codec = current;
|
webrtc::VideoCodec codec = current;
|
||||||
vie_codec.width = target_width;
|
codec.width = frame_width;
|
||||||
vie_codec.height = target_height;
|
codec.height = frame_height;
|
||||||
vie_codec.maxFramerate = target_codec.maxFramerate;
|
codec.maxFramerate = send_channel->adapt_format().framerate();
|
||||||
vie_codec.startBitrate = target_codec.startBitrate;
|
codec.startBitrate = send_codec_->startBitrate;
|
||||||
vie_codec.minBitrate = target_codec.minBitrate;
|
codec.minBitrate = send_codec_->minBitrate;
|
||||||
vie_codec.maxBitrate = target_codec.maxBitrate;
|
codec.maxBitrate = send_codec_->maxBitrate;
|
||||||
vie_codec.targetBitrate = 0;
|
codec.targetBitrate = 0;
|
||||||
if (vie_codec.codecType == webrtc::kVideoCodecVP8) {
|
if (frame.screencast) {
|
||||||
vie_codec.codecSpecific.VP8.automaticResizeOn = automatic_resize;
|
// Settings for screencast
|
||||||
vie_codec.codecSpecific.VP8.denoisingOn = enable_denoising;
|
codec.mode = webrtc::kScreensharing;
|
||||||
vie_codec.codecSpecific.VP8.frameDroppingOn = vp8_frame_dropping;
|
if (codec.codecType == webrtc::kVideoCodecVP8) {
|
||||||
|
codec.codecSpecific.VP8.denoisingOn = false;
|
||||||
|
codec.codecSpecific.VP8.automaticResizeOn = false;
|
||||||
|
codec.codecSpecific.VP8.frameDroppingOn = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Settings for non-screencast
|
||||||
|
codec.mode = webrtc::kRealtimeVideo;
|
||||||
|
if (codec.codecType == webrtc::kVideoCodecVP8) {
|
||||||
|
codec.codecSpecific.VP8.denoisingOn =
|
||||||
|
options_.video_noise_reduction.GetWithDefaultIfUnset(true);
|
||||||
|
codec.codecSpecific.VP8.automaticResizeOn = true;
|
||||||
|
codec.codecSpecific.VP8.frameDroppingOn = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
SanitizeBitrates(channel_id, &vie_codec);
|
SanitizeBitrates(channel_id, &codec);
|
||||||
|
|
||||||
if (current != vie_codec) {
|
if (current != codec) {
|
||||||
if (engine()->vie()->codec()->SetSendCodec(channel_id, vie_codec) != 0) {
|
if (engine()->vie()->codec()->SetSendCodec(channel_id, codec) != 0) {
|
||||||
LOG_RTCERR1(SetSendCodec, channel_id);
|
LOG_RTCERR1(SetSendCodec, channel_id);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frame.screencast) {
|
if (frame.screencast) {
|
||||||
|
int screencast_min_bitrate =
|
||||||
|
options_.screencast_min_bitrate.GetWithDefaultIfUnset(0);
|
||||||
engine()->vie()->rtp()->SetMinTransmitBitrate(channel_id,
|
engine()->vie()->rtp()->SetMinTransmitBitrate(channel_id,
|
||||||
screencast_min_bitrate);
|
screencast_min_bitrate);
|
||||||
} else {
|
} else {
|
||||||
@@ -4005,15 +3997,14 @@ bool WebRtcVideoMediaChannel::SetSendParams(
|
|||||||
engine()->vie()->rtp()->SetMinTransmitBitrate(channel_id, 0);
|
engine()->vie()->rtp()->SetMinTransmitBitrate(channel_id, 0);
|
||||||
}
|
}
|
||||||
engine()->vie()->rtp()->SetTransmissionSmoothingStatus(channel_id, true);
|
engine()->vie()->rtp()->SetTransmissionSmoothingStatus(channel_id, true);
|
||||||
|
|
||||||
// TODO(sriniv): SetSendCodec already sets ssrc's like below.
|
// TODO(sriniv): SetSendCodec already sets ssrc's like below.
|
||||||
// Consider removing.
|
// Consider removing.
|
||||||
|
if (send_channel->IsActive()) {
|
||||||
if (send_channel->IsActive() && !frame.screencast) {
|
if (!SetSendSsrcs(channel_id, send_params.stream, codec)) {
|
||||||
if (!SetSendSsrcs(channel_id, send_params.stream, target_codec)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user