| 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 27 matching lines...) Expand all Loading... |
| 38 STLDeleteElements(&buffers_); | 38 STLDeleteElements(&buffers_); |
| 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 DCHECK(jni_runtime_->display_task_runner()->BelongsToCurrentThread()); | 50 DCHECK(jni_runtime_->display_task_runner()->BelongsToCurrentThread()); |
| 50 | 51 |
| 51 if (bitmap_->size().width() != buffer->size().width() || | 52 if (bitmap_->size().width() != buffer->size().width() || |
| 52 bitmap_->size().height() != buffer->size().height()) { | 53 bitmap_->size().height() != buffer->size().height()) { |
| 53 // Drop the frame, since the data belongs to the previous generation, | 54 // Drop the frame, since the data belongs to the previous generation, |
| 54 // before SetSourceSize() called SetOutputSizeAndClip(). | 55 // before SetSourceSize() called SetOutputSizeAndClip(). |
| 55 FreeBuffer(buffer); | 56 FreeBuffer(buffer); |
| 56 return; | 57 return; |
| 57 } | 58 } |
| 58 | 59 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 } | 125 } |
| 125 | 126 |
| 126 void JniFrameConsumer::FreeBuffer(webrtc::DesktopFrame* buffer) { | 127 void JniFrameConsumer::FreeBuffer(webrtc::DesktopFrame* buffer) { |
| 127 DCHECK(std::find(buffers_.begin(), buffers_.end(), buffer) != buffers_.end()); | 128 DCHECK(std::find(buffers_.begin(), buffers_.end(), buffer) != buffers_.end()); |
| 128 | 129 |
| 129 buffers_.remove(buffer); | 130 buffers_.remove(buffer); |
| 130 delete buffer; | 131 delete buffer; |
| 131 } | 132 } |
| 132 | 133 |
| 133 } // namespace remoting | 134 } // namespace remoting |
| OLD | NEW |