| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/common/gpu/gpu_video_service.h" | 5 #include "content/common/gpu/gpu_video_service.h" |
| 6 | 6 |
| 7 #include "content/common/gpu/gpu_channel.h" | 7 #include "content/common/gpu/gpu_channel.h" |
| 8 #include "content/common/gpu/gpu_messages.h" | 8 #include "content/common/gpu/gpu_messages.h" |
| 9 #include "content/common/gpu/gpu_video_decode_accelerator.h" | 9 #include "content/common/gpu/gpu_video_decode_accelerator.h" |
| 10 | 10 |
| 11 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | |
| 12 #include "content/common/gpu/omx_video_decode_accelerator.h" | |
| 13 #endif // defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | |
| 14 | |
| 15 GpuVideoService::GpuVideoService() { | 11 GpuVideoService::GpuVideoService() { |
| 16 // TODO(jiesun): move this time consuming stuff out of here. | 12 // TODO(jiesun): move this time consuming stuff out of here. |
| 17 IntializeGpuVideoService(); | 13 IntializeGpuVideoService(); |
| 18 } | 14 } |
| 19 | 15 |
| 20 GpuVideoService::~GpuVideoService() { | 16 GpuVideoService::~GpuVideoService() { |
| 21 // TODO(jiesun): move this time consuming stuff out of here. | 17 // TODO(jiesun): move this time consuming stuff out of here. |
| 22 UnintializeGpuVideoService(); | 18 UnintializeGpuVideoService(); |
| 23 } | 19 } |
| 24 | 20 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 54 | 50 |
| 55 bool GpuVideoService::CreateVideoDecoder( | 51 bool GpuVideoService::CreateVideoDecoder( |
| 56 GpuChannel* channel, | 52 GpuChannel* channel, |
| 57 MessageRouter* router, | 53 MessageRouter* router, |
| 58 int32 decoder_host_id, | 54 int32 decoder_host_id, |
| 59 int32 decoder_id, | 55 int32 decoder_id, |
| 60 const std::vector<uint32>& configs) { | 56 const std::vector<uint32>& configs) { |
| 61 // Create GpuVideoDecodeAccelerator and add to map. | 57 // Create GpuVideoDecodeAccelerator and add to map. |
| 62 scoped_refptr<GpuVideoDecodeAccelerator> decoder = | 58 scoped_refptr<GpuVideoDecodeAccelerator> decoder = |
| 63 new GpuVideoDecodeAccelerator(channel, decoder_host_id); | 59 new GpuVideoDecodeAccelerator(channel, decoder_host_id); |
| 64 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | |
| 65 decoder->set_video_decode_accelerator( | |
| 66 new OmxVideoDecodeAccelerator(decoder, MessageLoop::current())); | |
| 67 #endif // defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | |
| 68 | 60 |
| 69 bool result = decoder_map_.insert(std::make_pair(decoder_id, decoder)).second; | 61 bool result = decoder_map_.insert(std::make_pair(decoder_id, decoder)).second; |
| 70 | 62 |
| 71 // Decoder ID is a unique ID determined by GpuVideoServiceHost. | 63 // Decoder ID is a unique ID determined by GpuVideoServiceHost. |
| 72 // We should always be adding entries here. | 64 // We should always be adding entries here. |
| 73 DCHECK(result); | 65 DCHECK(result); |
| 74 | 66 |
| 75 router->AddRoute(decoder_id, decoder); | 67 router->AddRoute(decoder_id, decoder); |
| 76 | 68 |
| 77 // Tell client that initialization is complete. | 69 // Tell client that initialization is complete. |
| 78 channel->Send( | 70 channel->Send( |
| 79 new AcceleratedVideoDecoderHostMsg_CreateDone( | 71 new AcceleratedVideoDecoderHostMsg_CreateDone( |
| 80 decoder_host_id, decoder_id)); | 72 decoder_host_id, decoder_id)); |
| 81 | 73 |
| 82 return true; | 74 return true; |
| 83 } | 75 } |
| 84 | 76 |
| 85 void GpuVideoService::DestroyVideoDecoder( | 77 void GpuVideoService::DestroyVideoDecoder( |
| 86 MessageRouter* router, | 78 MessageRouter* router, |
| 87 int32 decoder_id) { | 79 int32 decoder_id) { |
| 88 router->RemoveRoute(decoder_id); | 80 router->RemoveRoute(decoder_id); |
| 89 decoder_map_.erase(decoder_id); | 81 decoder_map_.erase(decoder_id); |
| 90 } | 82 } |
| OLD | NEW |