| 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" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 DCHECK(CalledOnValidThread()); | 74 DCHECK(CalledOnValidThread()); |
| 75 if (channel_) { | 75 if (channel_) { |
| 76 if (decoder_route_id_ != MSG_ROUTING_NONE) | 76 if (decoder_route_id_ != MSG_ROUTING_NONE) |
| 77 channel_->RemoveRoute(decoder_route_id_); | 77 channel_->RemoveRoute(decoder_route_id_); |
| 78 channel_ = NULL; | 78 channel_ = NULL; |
| 79 } | 79 } |
| 80 DLOG(ERROR) << "OnChannelError()"; | 80 DLOG(ERROR) << "OnChannelError()"; |
| 81 PostNotifyError(PLATFORM_FAILURE); | 81 PostNotifyError(PLATFORM_FAILURE); |
| 82 } | 82 } |
| 83 | 83 |
| 84 bool GpuVideoDecodeAcceleratorHost::Initialize(media::VideoCodecProfile profile, | 84 bool GpuVideoDecodeAcceleratorHost::Initialize(const Config& config, |
| 85 Client* client) { | 85 Client* client) { |
| 86 DCHECK(CalledOnValidThread()); | 86 DCHECK(CalledOnValidThread()); |
| 87 client_ = client; | 87 client_ = client; |
| 88 | 88 |
| 89 if (!impl_) | 89 if (!impl_) |
| 90 return false; | 90 return false; |
| 91 | 91 |
| 92 int32 route_id = channel_->GenerateRouteID(); | 92 int32 route_id = channel_->GenerateRouteID(); |
| 93 channel_->AddRoute(route_id, weak_this_factory_.GetWeakPtr()); | 93 channel_->AddRoute(route_id, weak_this_factory_.GetWeakPtr()); |
| 94 | 94 |
| 95 bool succeeded = false; | 95 bool succeeded = false; |
| 96 Send(new GpuCommandBufferMsg_CreateVideoDecoder(impl_->route_id(), profile, | 96 Send(new GpuCommandBufferMsg_CreateVideoDecoder(impl_->route_id(), config, |
| 97 route_id, &succeeded)); | 97 route_id, &succeeded)); |
| 98 | 98 |
| 99 if (!succeeded) { | 99 if (!succeeded) { |
| 100 DLOG(ERROR) << "Send(GpuCommandBufferMsg_CreateVideoDecoder()) failed"; | 100 DLOG(ERROR) << "Send(GpuCommandBufferMsg_CreateVideoDecoder()) failed"; |
| 101 PostNotifyError(PLATFORM_FAILURE); | 101 PostNotifyError(PLATFORM_FAILURE); |
| 102 channel_->RemoveRoute(route_id); | 102 channel_->RemoveRoute(route_id); |
| 103 return false; | 103 return false; |
| 104 } | 104 } |
| 105 decoder_route_id_ = route_id; | 105 decoder_route_id_ = route_id; |
| 106 return true; | 106 return true; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 weak_this_factory_.InvalidateWeakPtrs(); | 282 weak_this_factory_.InvalidateWeakPtrs(); |
| 283 | 283 |
| 284 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the | 284 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the |
| 285 // last thing done on this stack! | 285 // last thing done on this stack! |
| 286 media::VideoDecodeAccelerator::Client* client = NULL; | 286 media::VideoDecodeAccelerator::Client* client = NULL; |
| 287 std::swap(client, client_); | 287 std::swap(client, client_); |
| 288 client->NotifyError(static_cast<media::VideoDecodeAccelerator::Error>(error)); | 288 client->NotifyError(static_cast<media::VideoDecodeAccelerator::Error>(error)); |
| 289 } | 289 } |
| 290 | 290 |
| 291 } // namespace content | 291 } // namespace content |
| OLD | NEW |