summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/gpu_video_decoder_host.cc
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-09 16:27:08 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-09 16:27:08 +0000
commit25b04750be362f20f235d58da43aac774d4f4524 (patch)
treea7ebb119b721ea5bdf2eca0b319082600bcc0482 /chrome/renderer/gpu_video_decoder_host.cc
parent9f33ba5fbe668ea4c1ce1c35ac8b92a989f475f3 (diff)
downloadchromium_src-25b04750be362f20f235d58da43aac774d4f4524.zip
chromium_src-25b04750be362f20f235d58da43aac774d4f4524.tar.gz
chromium_src-25b04750be362f20f235d58da43aac774d4f4524.tar.bz2
Remove FFmpegVideoDecodeEngine's dependency on AVStream.
First step of many towards removing DemuxerStream::QueryInterface, AVStreamProvider, and MediaFormat. BUG=28206 TEST=media_unittests Review URL: http://codereview.chromium.org/6624062 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77476 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/gpu_video_decoder_host.cc')
-rw-r--r--chrome/renderer/gpu_video_decoder_host.cc54
1 files changed, 29 insertions, 25 deletions
diff --git a/chrome/renderer/gpu_video_decoder_host.cc b/chrome/renderer/gpu_video_decoder_host.cc
index 23756ad..fb96eb9 100644
--- a/chrome/renderer/gpu_video_decoder_host.cc
+++ b/chrome/renderer/gpu_video_decoder_host.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -19,12 +19,13 @@ GpuVideoDecoderHost::GpuVideoDecoderHost(MessageRouter* router,
message_loop_(NULL),
event_handler_(NULL),
context_(NULL),
+ width_(0),
+ height_(0),
state_(kStateUninitialized),
decoder_host_id_(decoder_host_id),
decoder_id_(0),
input_buffer_busy_(false),
current_frame_id_(0) {
- memset(&config_, 0, sizeof(config_));
}
GpuVideoDecoderHost::~GpuVideoDecoderHost() {}
@@ -65,33 +66,21 @@ bool GpuVideoDecoderHost::OnMessageReceived(const IPC::Message& msg) {
void GpuVideoDecoderHost::Initialize(
MessageLoop* message_loop, VideoDecodeEngine::EventHandler* event_handler,
media::VideoDecodeContext* context, const media::VideoCodecConfig& config) {
- if (MessageLoop::current() != message_loop) {
- message_loop->PostTask(
- FROM_HERE,
- NewRunnableMethod(this, &GpuVideoDecoderHost::Initialize, message_loop,
- event_handler, context, config));
- return;
- }
-
- // Initialization operations should be performed on the message loop assigned.
- // Save the parameters and post a task to complete initialization.
DCHECK_EQ(kStateUninitialized, state_);
DCHECK(!message_loop_);
message_loop_ = message_loop;
event_handler_ = event_handler;
context_ = context;
- config_ = config;
-
- // Add the route so we'll receive messages.
- router_->AddRoute(decoder_host_id_, this);
+ width_ = config.width();
+ height_ = config.height();
- if (!ipc_sender_->Send(
- new GpuChannelMsg_CreateVideoDecoder(context_route_id_,
- decoder_host_id_))) {
- LOG(ERROR) << "GpuChannelMsg_CreateVideoDecoder failed";
- event_handler_->OnError();
+ if (MessageLoop::current() != message_loop) {
+ message_loop->PostTask(
+ FROM_HERE,
+ NewRunnableMethod(this, &GpuVideoDecoderHost::CreateVideoDecoder));
return;
}
+ CreateVideoDecoder();
}
void GpuVideoDecoderHost::ConsumeVideoSample(scoped_refptr<Buffer> buffer) {
@@ -190,14 +179,29 @@ void GpuVideoDecoderHost::Seek() {
}
}
+void GpuVideoDecoderHost::CreateVideoDecoder() {
+ DCHECK_EQ(message_loop_, MessageLoop::current());
+
+ // Add the route so we'll receive messages.
+ router_->AddRoute(decoder_host_id_, this);
+
+ if (!ipc_sender_->Send(
+ new GpuChannelMsg_CreateVideoDecoder(context_route_id_,
+ decoder_host_id_))) {
+ LOG(ERROR) << "GpuChannelMsg_CreateVideoDecoder failed";
+ event_handler_->OnError();
+ return;
+ }
+}
+
void GpuVideoDecoderHost::OnCreateVideoDecoderDone(int32 decoder_id) {
DCHECK_EQ(message_loop_, MessageLoop::current());
decoder_id_ = decoder_id;
// TODO(hclam): Initialize |param| with the right values.
GpuVideoDecoderInitParam param;
- param.width = config_.width;
- param.height = config_.height;
+ param.width = width_;
+ param.height = height_;
if (!ipc_sender_->Send(
new GpuVideoDecoderMsg_Initialize(decoder_id, param))) {
@@ -225,8 +229,8 @@ void GpuVideoDecoderHost::OnInitializeDone(
// TODO(hclam): Need to fill in more information.
media::VideoCodecInfo info;
info.success = success;
- info.stream_info.surface_width = config_.width;
- info.stream_info.surface_height = config_.height;
+ info.stream_info.surface_width = width_;
+ info.stream_info.surface_height = height_;
event_handler_->OnInitializeComplete(info);
}