From dce3feb0b02bf1b7809f6247943979094de88593 Mon Sep 17 00:00:00 2001 From: "henrike@webrtc.org" Date: Wed, 26 Mar 2014 01:17:30 +0000 Subject: [PATCH] (Auto)update libjingle 63738002-> 63773382 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5787 4adac7df-926f-26a2-2b94-8c16560cd09d --- talk/app/webrtc/mediaconstraintsinterface.cc | 8 ++ talk/app/webrtc/mediaconstraintsinterface.h | 7 ++ talk/app/webrtc/webrtcsession.cc | 28 +++++++ .../examples/ios/AppRTCDemo/APPRTCVideoView.h | 43 ---------- .../examples/ios/AppRTCDemo/APPRTCVideoView.m | 82 ------------------- talk/media/base/mediachannel.h | 22 ++++- talk/media/other/androidmediaengine.cc | 0 talk/media/other/androidmediaengine.h | 0 talk/media/webrtc/fakewebrtcvideoengine.h | 4 - talk/media/webrtc/webrtcvideoengine.cc | 43 ++++++++++ .../webrtc/webrtcvideoengine_unittest.cc | 3 - 11 files changed, 107 insertions(+), 133 deletions(-) delete mode 100644 talk/examples/ios/AppRTCDemo/APPRTCVideoView.h delete mode 100644 talk/examples/ios/AppRTCDemo/APPRTCVideoView.m delete mode 100644 talk/media/other/androidmediaengine.cc delete mode 100644 talk/media/other/androidmediaengine.h diff --git a/talk/app/webrtc/mediaconstraintsinterface.cc b/talk/app/webrtc/mediaconstraintsinterface.cc index cd9bdc1c30..732cdcd18a 100644 --- a/talk/app/webrtc/mediaconstraintsinterface.cc +++ b/talk/app/webrtc/mediaconstraintsinterface.cc @@ -77,6 +77,14 @@ const char MediaConstraintsInterface::kCpuUnderuseThreshold[] = const char MediaConstraintsInterface::kCpuOveruseThreshold[] = "googCpuOveruseThreshold"; +// Google-specific PeerConnection constraint keys. +const char MediaConstraintsInterface::kImprovedWifiBwe[] = + "googImprovedWifiBwe"; +const char MediaConstraintsInterface::kScreencastMinBitrate[] = + "googScreencastMinBitrate"; +const char MediaConstraintsInterface::kSkipEncodingUnusedStreams[] = + "googSkipEncodingUnusedStreams"; + // Constraint keys for CreateOffer / CreateAnswer defined in W3C specification. const char MediaConstraintsInterface::kOfferToReceiveAudio[] = "OfferToReceiveAudio"; diff --git a/talk/app/webrtc/mediaconstraintsinterface.h b/talk/app/webrtc/mediaconstraintsinterface.h index 69d49e8673..d4e4ba5c16 100644 --- a/talk/app/webrtc/mediaconstraintsinterface.h +++ b/talk/app/webrtc/mediaconstraintsinterface.h @@ -87,12 +87,19 @@ class MediaConstraintsInterface { // Google-specific constraint keys for a local video source static const char kNoiseReduction[]; // googNoiseReduction static const char kLeakyBucket[]; // googLeakyBucket + // googTemporalLayeredScreencast static const char kTemporalLayeredScreencast[]; static const char kCpuOveruseDetection[]; static const char kCpuUnderuseThreshold[]; static const char kCpuOveruseThreshold[]; + // Google-specific PeerConnection constraint keys. + static const char kImprovedWifiBwe[]; // googImprovedWifiBwe + static const char kScreencastMinBitrate[]; // googScreencastMinBitrate + static const char kSkipEncodingUnusedStreams[]; + // googSkipEncodingUnusedStreams + // Constraint keys for CreateOffer / CreateAnswer // Specified by the W3C PeerConnection spec static const char kOfferToReceiveVideo[]; // OfferToReceiveVideo diff --git a/talk/app/webrtc/webrtcsession.cc b/talk/app/webrtc/webrtcsession.cc index f04baeaf59..f987993196 100644 --- a/talk/app/webrtc/webrtcsession.cc +++ b/talk/app/webrtc/webrtcsession.cc @@ -517,6 +517,34 @@ bool WebRtcSession::Initialize( video_options_.suspend_below_min_bitrate.Set(value); } + if (FindConstraint( + constraints, + MediaConstraintsInterface::kSkipEncodingUnusedStreams, + &value, + NULL)) { + video_options_.skip_encoding_unused_streams.Set(value); + } + + std::string string_value; + if (constraints && + constraints->GetOptional().FindFirst( + MediaConstraintsInterface::kScreencastMinBitrate, + &string_value)) { + int bitrate; + if (talk_base::FromString(string_value, &bitrate)) { + video_options_.screencast_min_bitrate.Set(bitrate); + } + } + + // Find improved wifi bwe constraint. + if (FindConstraint( + constraints, + MediaConstraintsInterface::kImprovedWifiBwe, + &value, + NULL)) { + video_options_.use_improved_wifi_bandwidth_estimator.Set(value); + } + const cricket::VideoCodec default_codec( JsepSessionDescription::kDefaultVideoCodecId, JsepSessionDescription::kDefaultVideoCodecName, diff --git a/talk/examples/ios/AppRTCDemo/APPRTCVideoView.h b/talk/examples/ios/AppRTCDemo/APPRTCVideoView.h deleted file mode 100644 index 238798e397..0000000000 --- a/talk/examples/ios/AppRTCDemo/APPRTCVideoView.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * libjingle - * Copyright 2013, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import - -@class RTCVideoTrack; - -// This class encapsulates VideoRenderIosView. -@interface APPRTCVideoView : UIView - -// Property to get/set required video orientation. -@property(nonatomic, assign) UIInterfaceOrientation videoOrientation; -// Specifies whether the object represents a local or remote video stream. -@property(nonatomic, assign) BOOL isRemote; - -// Sets up the underlying renderer and track objects. -- (void)renderVideoTrackInterface:(RTCVideoTrack*)track; - -@end diff --git a/talk/examples/ios/AppRTCDemo/APPRTCVideoView.m b/talk/examples/ios/AppRTCDemo/APPRTCVideoView.m deleted file mode 100644 index 23466b6c99..0000000000 --- a/talk/examples/ios/AppRTCDemo/APPRTCVideoView.m +++ /dev/null @@ -1,82 +0,0 @@ -/* - * libjingle - * Copyright 2013, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * This APPRTCVideoView must be initialzed and added to a View to get - * either the local or remote video stream rendered. - * It is a view itself and it encapsulates - * an object of VideoRenderIosView and UIActivityIndicatorView. - * Both of the views will get resized as per the frame of their parent. - */ - -#import "APPRTCVideoView.h" - -#import "RTCVideoRenderer.h" -#import "RTCVideoTrack.h" - -@interface APPRTCVideoView () { - RTCVideoTrack* _track; - RTCVideoRenderer* _renderer; -} - -@property(nonatomic, weak) UIView* renderView; -@property(nonatomic, weak) UIActivityIndicatorView* activityView; - -@end - -@implementation APPRTCVideoView - -@synthesize videoOrientation = _videoOrientation; - -- (void)layoutSubviews { - [super layoutSubviews]; - if (!_renderer) { - // Left-right (mirror) flip the remote view. - CGAffineTransform xform = - CGAffineTransformMakeScale(self.isRemote ? -1 : 1, 1); - // TODO(fischman): why is this rotate (vertical+horizontal flip) needed?!? - xform = CGAffineTransformRotate(xform, M_PI); - // TODO(fischman): ensure back-camera flip is correct in all orientations, - // when back-camera support is added. - [self setTransform:xform]; - _renderer = [[RTCVideoRenderer alloc] initWithView:self]; - } -} - -- (void)renderVideoTrackInterface:(RTCVideoTrack*)videoTrack { - [_track removeRenderer:_renderer]; - [_renderer stop]; - - _track = videoTrack; - - if (_track) { - [_track addRenderer:_renderer]; - [_renderer start]; - } -} - -@end diff --git a/talk/media/base/mediachannel.h b/talk/media/base/mediachannel.h index 5984815ad0..4ac578c407 100644 --- a/talk/media/base/mediachannel.h +++ b/talk/media/base/mediachannel.h @@ -329,6 +329,10 @@ struct VideoOptions { suspend_below_min_bitrate.SetFrom(change.suspend_below_min_bitrate); unsignalled_recv_stream_limit.SetFrom(change.unsignalled_recv_stream_limit); use_simulcast_adapter.SetFrom(change.use_simulcast_adapter); + skip_encoding_unused_streams.SetFrom(change.skip_encoding_unused_streams); + screencast_min_bitrate.SetFrom(change.screencast_min_bitrate); + use_improved_wifi_bandwidth_estimator.SetFrom( + change.use_improved_wifi_bandwidth_estimator); } bool operator==(const VideoOptions& o) const { @@ -359,7 +363,11 @@ struct VideoOptions { dscp == o.dscp && suspend_below_min_bitrate == o.suspend_below_min_bitrate && unsignalled_recv_stream_limit == o.unsignalled_recv_stream_limit && - use_simulcast_adapter == o.use_simulcast_adapter; + use_simulcast_adapter == o.use_simulcast_adapter && + skip_encoding_unused_streams == o.skip_encoding_unused_streams && + screencast_min_bitrate == o.screencast_min_bitrate; + use_improved_wifi_bandwidth_estimator == + o.use_improved_wifi_bandwidth_estimator; } std::string ToString() const { @@ -395,6 +403,11 @@ struct VideoOptions { ost << ToStringIfSet("num channels for early receive", unsignalled_recv_stream_limit); ost << ToStringIfSet("use simulcast adapter", use_simulcast_adapter); + ost << ToStringIfSet("skip encoding unused streams", + skip_encoding_unused_streams); + ost << ToStringIfSet("screencast min bitrate", screencast_min_bitrate); + ost << ToStringIfSet("improved wifi bwe", + use_improved_wifi_bandwidth_estimator); ost << "}"; return ost.str(); } @@ -454,6 +467,13 @@ struct VideoOptions { Settable unsignalled_recv_stream_limit; // Enable use of simulcast adapter. Settable use_simulcast_adapter; + // Enables the encoder to skip encoding stream not actually sent due to too + // low available bit rate. + Settable skip_encoding_unused_streams; + // Force screencast to use a minimum bitrate + Settable screencast_min_bitrate; + // Enable improved bandwidth estiamtor on wifi. + Settable use_improved_wifi_bandwidth_estimator; }; // A class for playing out soundclips. diff --git a/talk/media/other/androidmediaengine.cc b/talk/media/other/androidmediaengine.cc deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/talk/media/other/androidmediaengine.h b/talk/media/other/androidmediaengine.h deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/talk/media/webrtc/fakewebrtcvideoengine.h b/talk/media/webrtc/fakewebrtcvideoengine.h index 209c8fc497..1d4f19a32e 100644 --- a/talk/media/webrtc/fakewebrtcvideoengine.h +++ b/talk/media/webrtc/fakewebrtcvideoengine.h @@ -244,10 +244,6 @@ class FakeWebRtcVideoEncoderFactory : public WebRtcVideoEncoderFactory { (*it)->OnCodecsAvailable(); } - int GetNumCreatedEncoders() { - return num_created_encoders_; - } - const std::vector& encoders() { return encoders_; } diff --git a/talk/media/webrtc/webrtcvideoengine.cc b/talk/media/webrtc/webrtcvideoengine.cc index 1537f40b96..8a4566c083 100644 --- a/talk/media/webrtc/webrtcvideoengine.cc +++ b/talk/media/webrtc/webrtcvideoengine.cc @@ -2837,6 +2837,13 @@ bool WebRtcVideoMediaChannel::SetOptions(const VideoOptions &options) { conference_mode_turned_off = true; } +#ifdef USE_WEBRTC_DEV_BRANCH + bool improved_wifi_bwe_changed = + options.use_improved_wifi_bandwidth_estimator.IsSet() && + options_.use_improved_wifi_bandwidth_estimator != + options.use_improved_wifi_bandwidth_estimator; + +#endif // Save the options, to be interpreted where appropriate. // Use options_.SetAll() instead of assignment so that unset value in options @@ -2961,6 +2968,19 @@ bool WebRtcVideoMediaChannel::SetOptions(const VideoOptions &options) { LOG(LS_WARNING) << "Cannot disable video suspension once it is enabled"; } } +#ifdef USE_WEBRTC_DEV_BRANCH + if (improved_wifi_bwe_changed) { + webrtc::Config config; + config.Set(new webrtc::AimdRemoteRateControl( + options_.use_improved_wifi_bandwidth_estimator + .GetWithDefaultIfUnset(false))); + for (SendChannelMap::iterator it = send_channels_.begin(); + it != send_channels_.end(); ++it) { + engine()->vie()->network()->SetBandwidthEstimationConfig( + it->second->channel_id(), config); + } + } +#endif return true; } @@ -3753,6 +3773,11 @@ bool WebRtcVideoMediaChannel::MaybeResetVieSendCodec( // Disable denoising for screencasting. bool enable_denoising = options_.video_noise_reduction.GetWithDefaultIfUnset(false); +#ifdef USE_WEBRTC_DEV_BRANCH + int screencast_min_bitrate = + options_.screencast_min_bitrate.GetWithDefaultIfUnset(0); + bool leaky_bucket = options_.video_leaky_bucket.GetWithDefaultIfUnset(false); +#endif bool denoising = !is_screencast && enable_denoising; bool reset_send_codec = target_width != cur_width || target_height != cur_height || @@ -3786,6 +3811,24 @@ bool WebRtcVideoMediaChannel::MaybeResetVieSendCodec( LOG_RTCERR1(SetSendCodec, channel_id); return false; } + +#ifdef USE_WEBRTC_DEV_BRANCH + if (is_screencast) { + engine()->vie()->rtp()->SetMinTransmitBitrate(channel_id, + screencast_min_bitrate); + // If screencast and min bitrate set, force enable pacer. + if (screencast_min_bitrate > 0) { + engine()->vie()->rtp()->SetTransmissionSmoothingStatus(channel_id, + true); + } + } else { + // In case of switching from screencast to regular capture, set + // min bitrate padding and pacer back to defaults. + engine()->vie()->rtp()->SetMinTransmitBitrate(channel_id, 0); + engine()->vie()->rtp()->SetTransmissionSmoothingStatus(channel_id, + leaky_bucket); + } +#endif if (reset) { *reset = true; } diff --git a/talk/media/webrtc/webrtcvideoengine_unittest.cc b/talk/media/webrtc/webrtcvideoengine_unittest.cc index d305756fa2..c9663c5d37 100644 --- a/talk/media/webrtc/webrtcvideoengine_unittest.cc +++ b/talk/media/webrtc/webrtcvideoengine_unittest.cc @@ -1662,11 +1662,9 @@ TEST_F(WebRtcVideoEngineTestFake, DontRegisterEncoderMultipleTimes) { EXPECT_TRUE(vie_.ExternalEncoderRegistered(channel_num, 100)); EXPECT_EQ(1, vie_.GetNumExternalEncoderRegistered(channel_num)); - EXPECT_EQ(1, encoder_factory_.GetNumCreatedEncoders()); EXPECT_TRUE(channel_->SetSendCodecs(codecs)); EXPECT_EQ(1, vie_.GetNumExternalEncoderRegistered(channel_num)); - EXPECT_EQ(1, encoder_factory_.GetNumCreatedEncoders()); // Remove stream previously added to free the external encoder instance. EXPECT_TRUE(channel_->RemoveSendStream(kSsrc)); @@ -1798,7 +1796,6 @@ TEST_F(WebRtcVideoEngineTestFake, UpdateEncoderCodecsAfterSetFactory) { EXPECT_TRUE(vie_.ExternalEncoderRegistered(channel_num, 100)); EXPECT_EQ(1, vie_.GetNumExternalEncoderRegistered(channel_num)); - EXPECT_EQ(1, encoder_factory_.GetNumCreatedEncoders()); // Remove stream previously added to free the external encoder instance. EXPECT_TRUE(channel_->RemoveSendStream(kSsrc));