| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/plugin/pepper_video_renderer_2d.h" | 5 #include "remoting/client/plugin/pepper_video_renderer_2d.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 software_video_renderer_->OnSessionConfig(config); | 108 software_video_renderer_->OnSessionConfig(config); |
| 109 } | 109 } |
| 110 | 110 |
| 111 protocol::VideoStub* PepperVideoRenderer2D::GetVideoStub() { | 111 protocol::VideoStub* PepperVideoRenderer2D::GetVideoStub() { |
| 112 DCHECK(thread_checker_.CalledOnValidThread()); | 112 DCHECK(thread_checker_.CalledOnValidThread()); |
| 113 | 113 |
| 114 return software_video_renderer_->GetVideoStub(); | 114 return software_video_renderer_->GetVideoStub(); |
| 115 } | 115 } |
| 116 | 116 |
| 117 protocol::FrameConsumer* PepperVideoRenderer2D::GetFrameConsumer() { |
| 118 DCHECK(thread_checker_.CalledOnValidThread()); |
| 119 |
| 120 return software_video_renderer_->GetFrameConsumer(); |
| 121 } |
| 122 |
| 117 scoped_ptr<webrtc::DesktopFrame> PepperVideoRenderer2D::AllocateFrame( | 123 scoped_ptr<webrtc::DesktopFrame> PepperVideoRenderer2D::AllocateFrame( |
| 118 const webrtc::DesktopSize& size) { | 124 const webrtc::DesktopSize& size) { |
| 119 DCHECK(thread_checker_.CalledOnValidThread()); | 125 DCHECK(thread_checker_.CalledOnValidThread()); |
| 120 | 126 |
| 121 pp::ImageData buffer_data(instance_, PP_IMAGEDATAFORMAT_BGRA_PREMUL, | 127 pp::ImageData buffer_data(instance_, PP_IMAGEDATAFORMAT_BGRA_PREMUL, |
| 122 pp::Size(size.width(), size.height()), false); | 128 pp::Size(size.width(), size.height()), false); |
| 123 return make_scoped_ptr(new PepperDesktopFrame(buffer_data)); | 129 return make_scoped_ptr(new PepperDesktopFrame(buffer_data)); |
| 124 } | 130 } |
| 125 | 131 |
| 126 void PepperVideoRenderer2D::DrawFrame(scoped_ptr<webrtc::DesktopFrame> frame, | 132 void PepperVideoRenderer2D::DrawFrame(scoped_ptr<webrtc::DesktopFrame> frame, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 if (!done.is_null()) { | 186 if (!done.is_null()) { |
| 181 pending_frames_done_callbacks_.push_back( | 187 pending_frames_done_callbacks_.push_back( |
| 182 new base::ScopedClosureRunner(done)); | 188 new base::ScopedClosureRunner(done)); |
| 183 } | 189 } |
| 184 | 190 |
| 185 need_flush_ = true; | 191 need_flush_ = true; |
| 186 | 192 |
| 187 Flush(); | 193 Flush(); |
| 188 } | 194 } |
| 189 | 195 |
| 190 FrameConsumer::PixelFormat PepperVideoRenderer2D::GetPixelFormat() { | 196 protocol::FrameConsumer::PixelFormat PepperVideoRenderer2D::GetPixelFormat() { |
| 191 return FORMAT_BGRA; | 197 return FORMAT_BGRA; |
| 192 } | 198 } |
| 193 | 199 |
| 194 void PepperVideoRenderer2D::Flush() { | 200 void PepperVideoRenderer2D::Flush() { |
| 195 DCHECK(thread_checker_.CalledOnValidThread()); | 201 DCHECK(thread_checker_.CalledOnValidThread()); |
| 196 | 202 |
| 197 if (flush_pending_ || !need_flush_) | 203 if (flush_pending_ || !need_flush_) |
| 198 return; | 204 return; |
| 199 | 205 |
| 200 need_flush_ = false; | 206 need_flush_ = false; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 219 flush_pending_ = false; | 225 flush_pending_ = false; |
| 220 | 226 |
| 221 // Call all callbacks for the frames we've just flushed. | 227 // Call all callbacks for the frames we've just flushed. |
| 222 flushing_frames_done_callbacks_.clear(); | 228 flushing_frames_done_callbacks_.clear(); |
| 223 | 229 |
| 224 // Flush again if necessary. | 230 // Flush again if necessary. |
| 225 Flush(); | 231 Flush(); |
| 226 } | 232 } |
| 227 | 233 |
| 228 } // namespace remoting | 234 } // namespace remoting |
| OLD | NEW |