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