| 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/common/gpu/client/gpu_video_decode_accelerator_host.h" | 5 #include "content/common/gpu/client/gpu_video_decode_accelerator_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "content/common/gpu/client/gpu_channel_host.h" | 10 #include "content/common/gpu/client/gpu_channel_host.h" |
| 11 #include "content/common/gpu/gpu_messages.h" | 11 #include "content/common/gpu/gpu_messages.h" |
| 12 #include "content/common/gpu/media/gpu_video_accelerator_util.h" |
| 12 #include "content/common/view_messages.h" | 13 #include "content/common/view_messages.h" |
| 13 #include "ipc/ipc_message_macros.h" | 14 #include "ipc/ipc_message_macros.h" |
| 14 #include "ipc/ipc_message_utils.h" | 15 #include "ipc/ipc_message_utils.h" |
| 15 | 16 |
| 16 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
| 17 #include "content/public/common/sandbox_init.h" | 18 #include "content/public/common/sandbox_init.h" |
| 18 #endif // OS_WIN | 19 #endif // OS_WIN |
| 19 | 20 |
| 20 using media::VideoDecodeAccelerator; | 21 using media::VideoDecodeAccelerator; |
| 21 namespace content { | 22 namespace content { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 DCHECK(CalledOnValidThread()); | 73 DCHECK(CalledOnValidThread()); |
| 73 if (channel_) { | 74 if (channel_) { |
| 74 if (decoder_route_id_ != MSG_ROUTING_NONE) | 75 if (decoder_route_id_ != MSG_ROUTING_NONE) |
| 75 channel_->RemoveRoute(decoder_route_id_); | 76 channel_->RemoveRoute(decoder_route_id_); |
| 76 channel_ = NULL; | 77 channel_ = NULL; |
| 77 } | 78 } |
| 78 DLOG(ERROR) << "OnChannelError()"; | 79 DLOG(ERROR) << "OnChannelError()"; |
| 79 PostNotifyError(PLATFORM_FAILURE); | 80 PostNotifyError(PLATFORM_FAILURE); |
| 80 } | 81 } |
| 81 | 82 |
| 83 std::vector<media::VideoDecodeAccelerator::SupportedProfile> |
| 84 GpuVideoDecodeAcceleratorHost::GetSupportedProfiles() { |
| 85 DCHECK(CalledOnValidThread()); |
| 86 if (!channel_) |
| 87 return std::vector<media::VideoDecodeAccelerator::SupportedProfile>(); |
| 88 return GpuVideoAcceleratorUtil::ConvertGpuToMediaDecodeProfiles( |
| 89 channel_->gpu_info().video_decode_accelerator_supported_profiles); |
| 90 } |
| 91 |
| 82 bool GpuVideoDecodeAcceleratorHost::Initialize(media::VideoCodecProfile profile, | 92 bool GpuVideoDecodeAcceleratorHost::Initialize(media::VideoCodecProfile profile, |
| 83 Client* client) { | 93 Client* client) { |
| 84 DCHECK(CalledOnValidThread()); | 94 DCHECK(CalledOnValidThread()); |
| 85 client_ = client; | 95 client_ = client; |
| 86 | 96 |
| 87 if (!impl_) | 97 if (!impl_) |
| 88 return false; | 98 return false; |
| 89 | 99 |
| 90 int32 route_id = channel_->GenerateRouteID(); | 100 int32 route_id = channel_->GenerateRouteID(); |
| 91 channel_->AddRoute(route_id, weak_this_factory_.GetWeakPtr()); | 101 channel_->AddRoute(route_id, weak_this_factory_.GetWeakPtr()); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 weak_this_factory_.InvalidateWeakPtrs(); | 272 weak_this_factory_.InvalidateWeakPtrs(); |
| 263 | 273 |
| 264 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the | 274 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the |
| 265 // last thing done on this stack! | 275 // last thing done on this stack! |
| 266 media::VideoDecodeAccelerator::Client* client = NULL; | 276 media::VideoDecodeAccelerator::Client* client = NULL; |
| 267 std::swap(client, client_); | 277 std::swap(client, client_); |
| 268 client->NotifyError(static_cast<media::VideoDecodeAccelerator::Error>(error)); | 278 client->NotifyError(static_cast<media::VideoDecodeAccelerator::Error>(error)); |
| 269 } | 279 } |
| 270 | 280 |
| 271 } // namespace content | 281 } // namespace content |
| OLD | NEW |