OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/gpu/gpu_video_decoder.h" | 5 #include "chrome/gpu/gpu_video_decoder.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/common/child_thread.h" | 8 #include "chrome/common/child_thread.h" |
9 #include "chrome/common/gpu_messages.h" | 9 #include "chrome/common/gpu_messages.h" |
10 #include "chrome/gpu/gpu_channel.h" | 10 #include "chrome/gpu/gpu_channel.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 DCHECK(ret) << "Failed to switch context"; | 192 DCHECK(ret) << "Failed to switch context"; |
193 | 193 |
194 for (VideoFrameMap::iterator i = video_frame_map_.begin(); | 194 for (VideoFrameMap::iterator i = video_frame_map_.begin(); |
195 i != video_frame_map_.end(); ++i) { | 195 i != video_frame_map_.end(); ++i) { |
196 video_device_->ReleaseVideoFrame(i->second); | 196 video_device_->ReleaseVideoFrame(i->second); |
197 } | 197 } |
198 video_frame_map_.clear(); | 198 video_frame_map_.clear(); |
199 SendReleaseAllVideoFrames(); | 199 SendReleaseAllVideoFrames(); |
200 } | 200 } |
201 | 201 |
202 void GpuVideoDecoder::UploadToVideoFrame(void* buffer, | 202 void GpuVideoDecoder::ConvertToVideoFrame( |
203 scoped_refptr<media::VideoFrame> frame, | 203 void* buffer, |
204 Task* task) { | 204 scoped_refptr<media::VideoFrame> frame, |
| 205 Task* task) { |
205 // This method is called by VideoDecodeEngine to upload a buffer to a | 206 // This method is called by VideoDecodeEngine to upload a buffer to a |
206 // VideoFrame. We should just delegate this to GpuVideoDevice which contains | 207 // VideoFrame. We should just delegate this to GpuVideoDevice which contains |
207 // the actual implementation. | 208 // the actual implementation. |
208 bool ret = gles2_decoder_->MakeCurrent(); | 209 bool ret = gles2_decoder_->MakeCurrent(); |
209 DCHECK(ret) << "Failed to switch context"; | 210 DCHECK(ret) << "Failed to switch context"; |
210 | 211 |
211 // Actually doing the upload on the main thread. | 212 // Actually doing the upload on the main thread. |
212 ret = video_device_->UploadToVideoFrame(buffer, frame); | 213 ret = video_device_->ConvertToVideoFrame(buffer, frame); |
213 DCHECK(ret) << "Failed to upload video content to a VideoFrame."; | 214 DCHECK(ret) << "Failed to upload video content to a VideoFrame."; |
214 task->Run(); | 215 task->Run(); |
215 delete task; | 216 delete task; |
216 } | 217 } |
217 | 218 |
218 void GpuVideoDecoder::Destroy(Task* task) { | 219 void GpuVideoDecoder::Destroy(Task* task) { |
219 // TODO(hclam): I still need to think what I should do here. | 220 // TODO(hclam): I still need to think what I should do here. |
220 } | 221 } |
221 | 222 |
222 void GpuVideoDecoder::SetVideoDecodeEngine(media::VideoDecodeEngine* engine) { | 223 void GpuVideoDecoder::SetVideoDecodeEngine(media::VideoDecodeEngine* engine) { |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 } | 405 } |
405 } | 406 } |
406 | 407 |
407 void GpuVideoDecoder::SendReleaseAllVideoFrames() { | 408 void GpuVideoDecoder::SendReleaseAllVideoFrames() { |
408 if (!sender_->Send( | 409 if (!sender_->Send( |
409 new GpuVideoDecoderHostMsg_ReleaseAllVideoFrames( | 410 new GpuVideoDecoderHostMsg_ReleaseAllVideoFrames( |
410 decoder_host_id()))) { | 411 decoder_host_id()))) { |
411 LOG(ERROR) << "GpuVideoDecoderMsg_ReleaseAllVideoFrames failed"; | 412 LOG(ERROR) << "GpuVideoDecoderMsg_ReleaseAllVideoFrames failed"; |
412 } | 413 } |
413 } | 414 } |
OLD | NEW |