OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/client/jni/jni_frame_consumer.h" | 5 #include "remoting/client/jni/jni_frame_consumer.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 } | 39 } |
40 | 40 |
41 void JniFrameConsumer::set_frame_producer(FrameProducer* producer) { | 41 void JniFrameConsumer::set_frame_producer(FrameProducer* producer) { |
42 frame_producer_ = producer; | 42 frame_producer_ = producer; |
43 } | 43 } |
44 | 44 |
45 void JniFrameConsumer::ApplyBuffer(const webrtc::DesktopSize& view_size, | 45 void JniFrameConsumer::ApplyBuffer(const webrtc::DesktopSize& view_size, |
46 const webrtc::DesktopRect& clip_area, | 46 const webrtc::DesktopRect& clip_area, |
47 webrtc::DesktopFrame* buffer, | 47 webrtc::DesktopFrame* buffer, |
48 const webrtc::DesktopRegion& region, | 48 const webrtc::DesktopRegion& region, |
49 const webrtc::DesktopRegion& shape) { | 49 const webrtc::DesktopRegion* shape) { |
50 DCHECK(jni_runtime_->display_task_runner()->BelongsToCurrentThread()); | 50 DCHECK(jni_runtime_->display_task_runner()->BelongsToCurrentThread()); |
| 51 DCHECK(!shape); |
51 | 52 |
52 if (bitmap_->size().width() != buffer->size().width() || | 53 if (bitmap_->size().width() != buffer->size().width() || |
53 bitmap_->size().height() != buffer->size().height()) { | 54 bitmap_->size().height() != buffer->size().height()) { |
54 // Drop the frame, since the data belongs to the previous generation, | 55 // Drop the frame, since the data belongs to the previous generation, |
55 // before SetSourceSize() called SetOutputSizeAndClip(). | 56 // before SetSourceSize() called SetOutputSizeAndClip(). |
56 FreeBuffer(buffer); | 57 FreeBuffer(buffer); |
57 return; | 58 return; |
58 } | 59 } |
59 | 60 |
60 // Copy pixels from |buffer| into the Java Bitmap. | 61 // Copy pixels from |buffer| into the Java Bitmap. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 } | 126 } |
126 | 127 |
127 void JniFrameConsumer::FreeBuffer(webrtc::DesktopFrame* buffer) { | 128 void JniFrameConsumer::FreeBuffer(webrtc::DesktopFrame* buffer) { |
128 DCHECK(std::find(buffers_.begin(), buffers_.end(), buffer) != buffers_.end()); | 129 DCHECK(std::find(buffers_.begin(), buffers_.end(), buffer) != buffers_.end()); |
129 | 130 |
130 buffers_.remove(buffer); | 131 buffers_.remove(buffer); |
131 delete buffer; | 132 delete buffer; |
132 } | 133 } |
133 | 134 |
134 } // namespace remoting | 135 } // namespace remoting |
OLD | NEW |