summaryrefslogtreecommitdiff
path: root/media/webrtc
diff options
context:
space:
mode:
authorbuildbot@webrtc.org <buildbot@webrtc.org>2014-10-27 16:20:42 +0000
committerbuildbot@webrtc.org <buildbot@webrtc.org>2014-10-27 16:20:42 +0000
commit10f2fabdeb9c42633d60feffc8e475b59f93fd5c (patch)
tree7f49f8f474e7c688c97c9c68ef88d393930dfd0a /media/webrtc
parent1d3853cbd663530ec6d1c5c56fb068489bee3963 (diff)
downloadtalk-10f2fabdeb9c42633d60feffc8e475b59f93fd5c.tar.gz
(Auto)update libjingle 78583324-> 78583691
git-svn-id: http://webrtc.googlecode.com/svn/trunk/talk@7532 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'media/webrtc')
-rw-r--r--media/webrtc/webrtcvideoengine.cc127
-rw-r--r--media/webrtc/webrtcvideoengine.h3
2 files changed, 39 insertions, 91 deletions
diff --git a/media/webrtc/webrtcvideoengine.cc b/media/webrtc/webrtcvideoengine.cc
index 0a708d2..8b4ec68 100644
--- a/media/webrtc/webrtcvideoengine.cc
+++ b/media/webrtc/webrtcvideoengine.cc
@@ -3664,81 +3664,34 @@ bool WebRtcVideoMediaChannel::SetSendCodec(const webrtc::VideoCodec& codec) {
bool WebRtcVideoMediaChannel::SetSendCodec(
WebRtcVideoChannelSendInfo* send_channel,
- const webrtc::VideoCodec& target) {
+ const webrtc::VideoCodec& codec) {
if (!send_channel) {
return false;
}
send_channel->SetAdaptFormat(
- VideoFormatFromVieCodec(target),
+ VideoFormatFromVieCodec(codec),
WebRtcVideoChannelSendInfo::kAdaptFormatTypeCodec);
- const int channel_id = send_channel->channel_id();
- // Make a copy of the codec
- webrtc::VideoCodec codec = target;
-
- // Set the default number of temporal layers for VP8.
- if (webrtc::kVideoCodecVP8 == codec.codecType) {
- codec.codecSpecific.VP8.numberOfTemporalLayers =
- kDefaultNumberOfTemporalLayers;
-
- // Turn off the VP8 error resilience
- codec.codecSpecific.VP8.resilience = webrtc::kResilienceOff;
-
- bool enable_denoising =
- options_.video_noise_reduction.GetWithDefaultIfUnset(true);
- codec.codecSpecific.VP8.denoisingOn = enable_denoising;
- }
-
MaybeRegisterExternalEncoder(send_channel, codec);
- // TODO(pthatcher): We should rely on the adapter to adapt the
- // resolution, and not do it here.
- if (send_channel->adapt_format_set()) {
- codec.width = send_channel->adapt_format().width;
- codec.height = send_channel->adapt_format().height;
- codec.maxFramerate = cricket::VideoFormat::IntervalToFps(
- send_channel->adapt_format().interval);
- }
-
- if (codec.width == 0 && codec.height == 0) {
- const uint32 ssrc = send_channel->stream_params().first_ssrc();
- LOG(LS_INFO) << "0x0 resolution selected. Captured frames will be dropped "
- << "for ssrc: " << ssrc << ".";
- return true;
- }
-
- const StreamParams& sp = send_channel->stream_params();
- 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);
+ VideoSendParams send_params = send_channel->send_params();
+ send_params.codec = codec;
+ if (!SetSendParams(send_channel, send_params)) {
return false;
}
- if (send_channel->IsActive()) {
- if (!SetSendSsrcs(channel_id, sp, codec)) {
- return false;
- }
- }
-
// NOTE: SetRtxSendPayloadType must be called after all simulcast SSRCs
// are configured. Otherwise ssrc's configured after this point will use
// the primary PT for RTX.
+ const int channel_id = send_channel->channel_id();
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;
}
@@ -3911,54 +3864,41 @@ int WebRtcVideoMediaChannel::GetRecvChannelId(uint32 ssrc) {
return recv_channel_id;
}
-// If the new frame size is different from the send codec size we set on vie,
-// we need to reset the send codec on vie.
-// The new send codec size should not exceed send_codec_ which is controlled
-// only by the 'jec' logic.
-// TODO(pthatcher): Get rid of this function, so we only ever set up
-// codecs in a single place.
bool WebRtcVideoMediaChannel::SetSendParams(
WebRtcVideoChannelSendInfo* send_channel,
const VideoSendParams& send_params) {
- ASSERT(send_codec_.get() != NULL);
+ const int channel_id = send_channel->channel_id();
CapturedFrameInfo frame;
- if (!send_channel->last_captured_frame_info().Get(&frame)) {
- // No captured frame yet, so nothing to set.
- return true;
- }
+ send_channel->last_captured_frame_info().Get(&frame);
- // TODO(pthatcher): This is only needed because some unit tests
- // bypass the VideoAdapter, and others expect behavior from the
- // adapter different than what it actually does. We should fix the
- // tests and remove this.
+ // TODO(pthatcher): This checking of the max height and width is
+ // only needed because some unit tests bypass the VideoAdapter, and
+ // others expect behavior from the adapter different than what it
+ // actually does. We should fix the tests and remove this block.
int frame_width = static_cast<int>(frame.width);
int frame_height = static_cast<int>(frame.height);
- if (!frame.screencast && send_channel->adapt_format_set()) {
- VideoFormat max = send_channel->adapt_format();
- if (frame_width > max.width || frame_height > max.height) {
- frame_width = max.width;
- frame_height = max.height;
- }
- }
-
- // Get current vie codec.
- webrtc::VideoCodec current;
- const int channel_id = send_channel->channel_id();
- if (engine()->vie()->codec()->GetSendCodec(channel_id, current) != 0) {
- LOG_RTCERR1(GetSendCodec, channel_id);
- return false;
+ VideoFormat max = send_channel->adapt_format();
+ if (!send_channel->last_captured_frame_info().IsSet() ||
+ (!frame.screencast &&
+ (frame_width > max.width || frame_height > max.height))) {
+ frame_width = max.width;
+ frame_height = max.height;
}
// Set the new codec on vie.
- webrtc::VideoCodec codec = current;
+ webrtc::VideoCodec codec = send_params.codec;
+
+ // Settings for both screencast and non-screencast
codec.width = frame_width;
codec.height = frame_height;
- codec.maxFramerate = send_channel->adapt_format().framerate();
- codec.startBitrate = send_codec_->startBitrate;
- codec.minBitrate = send_codec_->minBitrate;
- codec.maxBitrate = send_codec_->maxBitrate;
+ codec.maxFramerate = max.framerate();
codec.targetBitrate = 0;
+ if (codec.codecType == webrtc::kVideoCodecVP8) {
+ codec.codecSpecific.VP8.numberOfTemporalLayers =
+ kDefaultNumberOfTemporalLayers;
+ codec.codecSpecific.VP8.resilience = webrtc::kResilienceOff;
+ }
if (frame.screencast) {
// Settings for screencast
codec.mode = webrtc::kScreensharing;
@@ -3979,6 +3919,13 @@ bool WebRtcVideoMediaChannel::SetSendParams(
}
SanitizeBitrates(channel_id, &codec);
+ // Get current vie codec.
+ webrtc::VideoCodec current;
+ if (engine()->vie()->codec()->GetSendCodec(channel_id, current) != 0) {
+ LOG_RTCERR1(GetSendCodec, channel_id);
+ return false;
+ }
+
if (current != codec) {
if (engine()->vie()->codec()->SetSendCodec(channel_id, codec) != 0) {
LOG_RTCERR1(SetSendCodec, channel_id);
@@ -3998,13 +3945,13 @@ bool WebRtcVideoMediaChannel::SetSendParams(
}
engine()->vie()->rtp()->SetTransmissionSmoothingStatus(channel_id, true);
- // TODO(sriniv): SetSendCodec already sets ssrc's like below.
- // Consider removing.
if (send_channel->IsActive()) {
if (!SetSendSsrcs(channel_id, send_params.stream, codec)) {
return false;
}
}
+
+ send_channel->set_send_params(send_params);
return true;
}
diff --git a/media/webrtc/webrtcvideoengine.h b/media/webrtc/webrtcvideoengine.h
index 9c7751f..26b0453 100644
--- a/media/webrtc/webrtcvideoengine.h
+++ b/media/webrtc/webrtcvideoengine.h
@@ -244,8 +244,9 @@ struct CapturedFrameInfo {
bool screencast;
};
-// TODO(pthatcher): Add codec and VideoOptions.
+// TODO(pthatcher): Add VideoOptions.
struct VideoSendParams {
+ webrtc::VideoCodec codec;
StreamParams stream;
};