diff options
author | wez <wez@chromium.org> | 2015-07-16 20:19:15 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-17 03:19:47 +0000 |
commit | 070889be6cd0ff3425d6260fbaac59ed24f34627 (patch) | |
tree | c632b4fce22c055542e0b03f4ab4653ab14c0331 /remoting/client/jni | |
parent | 78b7284f164e10ecb382196bf38692410d11103b (diff) | |
download | chromium_src-070889be6cd0ff3425d6260fbaac59ed24f34627.zip chromium_src-070889be6cd0ff3425d6260fbaac59ed24f34627.tar.gz chromium_src-070889be6cd0ff3425d6260fbaac59ed24f34627.tar.bz2 |
Allow shaped-desktop hosts to send shape only when it changes.
Previously hosts supplying a shaped desktop needed to attach the desktop
shape to every frame, wasting bandwidth since the shape changes
relatively infrequently.
This CL updates the VideoRenderer implementations to preserve the shape
(or lack of one) from the preceding frame if the VideoPacket does not
include the use_desktop_shape field.
Also simplifies FrameConsumerProxy to remove the need for ref-counting,
updates NULL->nullptr throughout remoting/codec/, and removes
unnecessary transparency logic from VideoDecoderVpx.
BUG=446288
Review URL: https://codereview.chromium.org/1236663002
Cr-Commit-Position: refs/heads/master@{#339212}
Diffstat (limited to 'remoting/client/jni')
-rw-r--r-- | remoting/client/jni/chromoting_jni_instance.cc | 22 | ||||
-rw-r--r-- | remoting/client/jni/chromoting_jni_instance.h | 6 | ||||
-rw-r--r-- | remoting/client/jni/jni_frame_consumer.cc | 3 | ||||
-rw-r--r-- | remoting/client/jni/jni_frame_consumer.h | 2 |
4 files changed, 17 insertions, 16 deletions
diff --git a/remoting/client/jni/chromoting_jni_instance.cc b/remoting/client/jni/chromoting_jni_instance.cc index fd19dea..a30c2f4 100644 --- a/remoting/client/jni/chromoting_jni_instance.cc +++ b/remoting/client/jni/chromoting_jni_instance.cc @@ -387,28 +387,28 @@ void ChromotingJniInstance::ConnectToHostOnDisplayThread() { view_.reset(new JniFrameConsumer(jni_runtime_, this)); view_weak_factory_.reset(new base::WeakPtrFactory<JniFrameConsumer>( view_.get())); - frame_consumer_ = new FrameConsumerProxy(jni_runtime_->display_task_runner(), - view_weak_factory_->GetWeakPtr()); + scoped_ptr<FrameConsumerProxy> frame_consumer = + make_scoped_ptr(new FrameConsumerProxy(view_weak_factory_->GetWeakPtr())); jni_runtime_->network_task_runner()->PostTask( FROM_HERE, - base::Bind(&ChromotingJniInstance::ConnectToHostOnNetworkThread, - this)); + base::Bind(&ChromotingJniInstance::ConnectToHostOnNetworkThread, this, + base::Passed(&frame_consumer))); } -void ChromotingJniInstance::ConnectToHostOnNetworkThread() { +void ChromotingJniInstance::ConnectToHostOnNetworkThread( + scoped_ptr<FrameConsumerProxy> frame_consumer) { DCHECK(jni_runtime_->network_task_runner()->BelongsToCurrentThread()); + DCHECK(frame_consumer); jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); - client_context_.reset(new ClientContext( - jni_runtime_->network_task_runner().get())); + client_context_.reset(new ClientContext(jni_runtime_->network_task_runner())); client_context_->Start(); - SoftwareVideoRenderer* renderer = - new SoftwareVideoRenderer(client_context_->main_task_runner(), - client_context_->decode_task_runner(), - frame_consumer_); + SoftwareVideoRenderer* renderer = new SoftwareVideoRenderer( + client_context_->main_task_runner(), + client_context_->decode_task_runner(), frame_consumer.Pass()); view_->set_frame_producer(renderer); video_renderer_.reset(renderer); diff --git a/remoting/client/jni/chromoting_jni_instance.h b/remoting/client/jni/chromoting_jni_instance.h index 4ac7b1d..2ce50e0 100644 --- a/remoting/client/jni/chromoting_jni_instance.h +++ b/remoting/client/jni/chromoting_jni_instance.h @@ -119,7 +119,8 @@ class ChromotingJniInstance ~ChromotingJniInstance() override; void ConnectToHostOnDisplayThread(); - void ConnectToHostOnNetworkThread(); + void ConnectToHostOnNetworkThread( + scoped_ptr<FrameConsumerProxy> frame_consumer); void DisconnectFromHostOnNetworkThread(); // Notifies the user interface that the user needs to enter a PIN. The @@ -150,9 +151,8 @@ class ChromotingJniInstance std::string host_jid_; // This group of variables is to be used on the display thread. - scoped_refptr<FrameConsumerProxy> frame_consumer_; scoped_ptr<JniFrameConsumer> view_; - scoped_ptr<base::WeakPtrFactory<JniFrameConsumer> > view_weak_factory_; + scoped_ptr<base::WeakPtrFactory<JniFrameConsumer>> view_weak_factory_; // This group of variables is to be used on the network thread. scoped_ptr<ClientContext> client_context_; diff --git a/remoting/client/jni/jni_frame_consumer.cc b/remoting/client/jni/jni_frame_consumer.cc index badb152..d921bfb 100644 --- a/remoting/client/jni/jni_frame_consumer.cc +++ b/remoting/client/jni/jni_frame_consumer.cc @@ -46,8 +46,9 @@ void JniFrameConsumer::ApplyBuffer(const webrtc::DesktopSize& view_size, const webrtc::DesktopRect& clip_area, webrtc::DesktopFrame* buffer, const webrtc::DesktopRegion& region, - const webrtc::DesktopRegion& shape) { + const webrtc::DesktopRegion* shape) { DCHECK(jni_runtime_->display_task_runner()->BelongsToCurrentThread()); + DCHECK(!shape); if (bitmap_->size().width() != buffer->size().width() || bitmap_->size().height() != buffer->size().height()) { diff --git a/remoting/client/jni/jni_frame_consumer.h b/remoting/client/jni/jni_frame_consumer.h index e69501cf..a9a0361 100644 --- a/remoting/client/jni/jni_frame_consumer.h +++ b/remoting/client/jni/jni_frame_consumer.h @@ -44,7 +44,7 @@ class JniFrameConsumer : public FrameConsumer { const webrtc::DesktopRect& clip_area, webrtc::DesktopFrame* buffer, const webrtc::DesktopRegion& region, - const webrtc::DesktopRegion& shape) override; + const webrtc::DesktopRegion* shape) override; void ReturnBuffer(webrtc::DesktopFrame* buffer) override; void SetSourceSize(const webrtc::DesktopSize& source_size, const webrtc::DesktopVector& dpi) override; |