Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Side by Side Diff: remoting/client/jni/jni_frame_consumer.cc

Issue 23677011: Byte-swap the video frame pixels before passing them to Java. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Narrow the synchronization block Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/client/jni/jni_frame_consumer.h ('k') | remoting/client/plugin/chromoting_instance.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "remoting/client/frame_producer.h" 10 #include "remoting/client/frame_producer.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // and cropping on the managed canvas. 102 // and cropping on the managed canvas.
103 view_size_ = source_size; 103 view_size_ = source_size;
104 clip_area_ = webrtc::DesktopRect::MakeSize(view_size_); 104 clip_area_ = webrtc::DesktopRect::MakeSize(view_size_);
105 frame_producer_->SetOutputSizeAndClip(view_size_, clip_area_); 105 frame_producer_->SetOutputSizeAndClip(view_size_, clip_area_);
106 106
107 // Unless being destructed, allocate buffer and start drawing frames onto it. 107 // Unless being destructed, allocate buffer and start drawing frames onto it.
108 frame_producer_->RequestReturnBuffers(base::Bind( 108 frame_producer_->RequestReturnBuffers(base::Bind(
109 &JniFrameConsumer::AllocateBuffer, base::Unretained(this))); 109 &JniFrameConsumer::AllocateBuffer, base::Unretained(this)));
110 } 110 }
111 111
112 FrameConsumer::PixelFormat JniFrameConsumer::GetPixelFormat() {
113 return FORMAT_RGBA;
114 }
115
112 void JniFrameConsumer::AllocateBuffer() { 116 void JniFrameConsumer::AllocateBuffer() {
113 // Only do anything if we're not being destructed. 117 // Only do anything if we're not being destructed.
114 if (!in_dtor_) { 118 if (!in_dtor_) {
115 if (!jni_runtime_->display_task_runner()->BelongsToCurrentThread()) { 119 if (!jni_runtime_->display_task_runner()->BelongsToCurrentThread()) {
116 jni_runtime_->display_task_runner()->PostTask(FROM_HERE, 120 jni_runtime_->display_task_runner()->PostTask(FROM_HERE,
117 base::Bind(&JniFrameConsumer::AllocateBuffer, 121 base::Bind(&JniFrameConsumer::AllocateBuffer,
118 base::Unretained(this))); 122 base::Unretained(this)));
119 return; 123 return;
120 } 124 }
121 125
122 DirectDesktopFrame* buffer = new DirectDesktopFrame(view_size_.width(), 126 DirectDesktopFrame* buffer = new DirectDesktopFrame(view_size_.width(),
123 view_size_.height()); 127 view_size_.height());
124 128
125 // Update Java's reference to the buffer and record of its dimensions. 129 // Update Java's reference to the buffer and record of its dimensions.
126 jni_runtime_->UpdateImageBuffer(view_size_.width(), 130 jni_runtime_->UpdateImageBuffer(view_size_.width(),
127 view_size_.height(), 131 view_size_.height(),
128 buffer->buffer()); 132 buffer->buffer());
129 133
130 frame_producer_->DrawBuffer(buffer); 134 frame_producer_->DrawBuffer(buffer);
131 } 135 }
132 } 136 }
133 137
134 } // namespace remoting 138 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/jni/jni_frame_consumer.h ('k') | remoting/client/plugin/chromoting_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698