| 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 "content/renderer/media/renderer_gpu_video_decoder_factories.h" | 5 #include "content/renderer/media/renderer_gpu_video_decoder_factories.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
| 9 #include "content/common/child_thread.h" | 9 #include "content/common/child_thread.h" |
| 10 #include "content/common/gpu/client/gpu_channel_host.h" | 10 #include "content/common/gpu/client/gpu_channel_host.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 base::WaitableEvent* waiter) { | 38 base::WaitableEvent* waiter) { |
| 39 wgc3dcbi->makeContextCurrent(); | 39 wgc3dcbi->makeContextCurrent(); |
| 40 context_ = wgc3dcbi->AsWeakPtr(); | 40 context_ = wgc3dcbi->AsWeakPtr(); |
| 41 if (waiter) | 41 if (waiter) |
| 42 waiter->Signal(); | 42 waiter->Signal(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 media::VideoDecodeAccelerator* | 45 media::VideoDecodeAccelerator* |
| 46 RendererGpuVideoDecoderFactories::CreateVideoDecodeAccelerator( | 46 RendererGpuVideoDecoderFactories::CreateVideoDecodeAccelerator( |
| 47 media::VideoCodecProfile profile, | 47 media::VideoCodecProfile profile, |
| 48 const gfx::Size& frame_size, |
| 49 const std::vector<uint8_t>& extra_data, |
| 48 media::VideoDecodeAccelerator::Client* client) { | 50 media::VideoDecodeAccelerator::Client* client) { |
| 49 DCHECK_NE(MessageLoop::current(), message_loop_); | 51 DCHECK_NE(MessageLoop::current(), message_loop_); |
| 50 media::VideoDecodeAccelerator* vda = NULL; | 52 media::VideoDecodeAccelerator* vda = NULL; |
| 51 base::WaitableEvent waiter(false, false); | 53 base::WaitableEvent waiter(false, false); |
| 52 message_loop_->PostTask(FROM_HERE, base::Bind( | 54 message_loop_->PostTask(FROM_HERE, base::Bind( |
| 53 &RendererGpuVideoDecoderFactories::AsyncCreateVideoDecodeAccelerator, | 55 &RendererGpuVideoDecoderFactories::AsyncCreateVideoDecodeAccelerator, |
| 54 this, profile, client, &vda, &waiter)); | 56 this, profile, frame_size, extra_data, client, &vda, &waiter)); |
| 55 waiter.Wait(); | 57 waiter.Wait(); |
| 56 return vda; | 58 return vda; |
| 57 } | 59 } |
| 58 | 60 |
| 59 void RendererGpuVideoDecoderFactories::AsyncCreateVideoDecodeAccelerator( | 61 void RendererGpuVideoDecoderFactories::AsyncCreateVideoDecodeAccelerator( |
| 60 media::VideoCodecProfile profile, | 62 media::VideoCodecProfile profile, |
| 63 const gfx::Size& frame_size, |
| 64 const std::vector<uint8_t>& extra_data, |
| 61 media::VideoDecodeAccelerator::Client* client, | 65 media::VideoDecodeAccelerator::Client* client, |
| 62 media::VideoDecodeAccelerator** vda, | 66 media::VideoDecodeAccelerator** vda, |
| 63 base::WaitableEvent* waiter) { | 67 base::WaitableEvent* waiter) { |
| 64 DCHECK_EQ(MessageLoop::current(), message_loop_); | 68 DCHECK_EQ(MessageLoop::current(), message_loop_); |
| 65 if (context_) { | 69 if (context_) { |
| 66 *vda = gpu_channel_host_->CreateVideoDecoder( | 70 *vda = gpu_channel_host_->CreateVideoDecoder( |
| 67 context_->GetCommandBufferProxy()->GetRouteID(), | 71 context_->GetCommandBufferProxy()->GetRouteID(), |
| 68 profile, client); | 72 profile, frame_size, extra_data, client); |
| 69 } else { | 73 } else { |
| 70 *vda = NULL; | 74 *vda = NULL; |
| 71 } | 75 } |
| 72 waiter->Signal(); | 76 waiter->Signal(); |
| 73 } | 77 } |
| 74 | 78 |
| 75 bool RendererGpuVideoDecoderFactories::CreateTextures( | 79 bool RendererGpuVideoDecoderFactories::CreateTextures( |
| 76 int32 count, const gfx::Size& size, | 80 int32 count, const gfx::Size& size, |
| 77 std::vector<uint32>* texture_ids, | 81 std::vector<uint32>* texture_ids, |
| 78 uint32* texture_target) { | 82 uint32* texture_target) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 waiter.Wait(); | 149 waiter.Wait(); |
| 146 return shm; | 150 return shm; |
| 147 } | 151 } |
| 148 | 152 |
| 149 void RendererGpuVideoDecoderFactories::AsyncCreateSharedMemory( | 153 void RendererGpuVideoDecoderFactories::AsyncCreateSharedMemory( |
| 150 size_t size, base::SharedMemory** shm, base::WaitableEvent* waiter) { | 154 size_t size, base::SharedMemory** shm, base::WaitableEvent* waiter) { |
| 151 DCHECK_EQ(MessageLoop::current(), ChildThread::current()->message_loop()); | 155 DCHECK_EQ(MessageLoop::current(), ChildThread::current()->message_loop()); |
| 152 *shm = ChildThread::current()->AllocateSharedMemory(size); | 156 *shm = ChildThread::current()->AllocateSharedMemory(size); |
| 153 waiter->Signal(); | 157 waiter->Signal(); |
| 154 } | 158 } |
| OLD | NEW |