summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-07 21:47:17 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-07 21:47:17 +0000
commit3bb08606c22e357896714764731a7af21e04377d (patch)
tree9d459e951749c408fad9e490d547d2da352c20cb
parente570464a01253a25520171f967fa3e7a97c70cb6 (diff)
downloadchromium_src-3bb08606c22e357896714764731a7af21e04377d.zip
chromium_src-3bb08606c22e357896714764731a7af21e04377d.tar.gz
chromium_src-3bb08606c22e357896714764731a7af21e04377d.tar.bz2
Make FakeGlVideoDecodeEngine works in the hardware video decoding architecture
Add Preroll IPC message for finishing the initialiation of FakeGlVideoDecodeEngine. Also defined methods in WebVideoFrameImpl to access video frame textures. This change depend on a WebKit change to succesfully display the textures. BUG=53714 TEST=Tree is green. This still needs WebKit changes to work. Review URL: http://codereview.chromium.org/3472016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61853 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/common/gpu_messages_internal.h10
-rw-r--r--chrome/gpu/gpu_video_decoder.cc17
-rw-r--r--chrome/gpu/gpu_video_decoder.h2
-rw-r--r--chrome/gpu/media/fake_gl_video_decode_engine.cc45
-rw-r--r--chrome/gpu/media/fake_gl_video_decode_engine.h5
-rw-r--r--chrome/renderer/ggl/ggl.cc13
-rw-r--r--chrome/renderer/ggl/ggl.h4
-rw-r--r--chrome/renderer/gpu_video_decoder_host.cc21
-rw-r--r--chrome/renderer/gpu_video_decoder_host.h1
-rw-r--r--chrome/renderer/gpu_video_service_host.cc3
-rw-r--r--chrome/renderer/media/gles2_video_decode_context.cc9
-rw-r--r--chrome/renderer/media/ipc_video_decoder.cc12
-rw-r--r--chrome/renderer/media/ipc_video_decoder.h2
-rw-r--r--chrome/renderer/render_view.cc15
-rw-r--r--media/filters/ffmpeg_demuxer.cc2
-rw-r--r--webkit/glue/webvideoframe_impl.cc2
16 files changed, 127 insertions, 36 deletions
diff --git a/chrome/common/gpu_messages_internal.h b/chrome/common/gpu_messages_internal.h
index daaaa24..86c5481 100644
--- a/chrome/common/gpu_messages_internal.h
+++ b/chrome/common/gpu_messages_internal.h
@@ -299,6 +299,9 @@ IPC_BEGIN_MESSAGES(GpuVideoDecoder)
// Start decoder flushing operation.
IPC_MESSAGE_ROUTED0(GpuVideoDecoderMsg_Flush)
+ // Tell the decoder to start prerolling.
+ IPC_MESSAGE_ROUTED0(GpuVideoDecoderMsg_Preroll)
+
// Send input buffer to GpuVideoDecoder.
IPC_MESSAGE_ROUTED1(GpuVideoDecoderMsg_EmptyThisBuffer,
GpuVideoDecoderInputBufferParam)
@@ -324,16 +327,23 @@ IPC_BEGIN_MESSAGES(GpuVideoDecoderHost)
int32) /* decoder_id */
// Confirm GpuVideoDecoder had been initialized or failed to initialize.
+ // TODO(hclam): Change this to Done instead of ACK.
IPC_MESSAGE_ROUTED1(GpuVideoDecoderHostMsg_InitializeACK,
GpuVideoDecoderInitDoneParam)
// Confrim GpuVideoDecoder had been destroyed properly.
+ // TODO(hclam): Change this to Done instead of ACK.
IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_DestroyACK)
// Confirm decoder had been flushed.
+ // TODO(hclam): Change this to Done instead of ACK.
IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_FlushACK)
+ // Confirm preroll operation is done.
+ IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_PrerollDone)
+
// GpuVideoDecoder has consumed input buffer from transfer buffer.
+ // TODO(hclam): Change this to Done instead of ACK.
IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_EmptyThisBufferACK)
// GpuVideoDecoder require new input buffer.
diff --git a/chrome/gpu/gpu_video_decoder.cc b/chrome/gpu/gpu_video_decoder.cc
index b316253..86bcd04 100644
--- a/chrome/gpu/gpu_video_decoder.cc
+++ b/chrome/gpu/gpu_video_decoder.cc
@@ -26,6 +26,8 @@ void GpuVideoDecoder::OnMessageReceived(const IPC::Message& msg) {
OnUninitialize)
IPC_MESSAGE_HANDLER(GpuVideoDecoderMsg_Flush,
OnFlush)
+ IPC_MESSAGE_HANDLER(GpuVideoDecoderMsg_Preroll,
+ OnPreroll)
IPC_MESSAGE_HANDLER(GpuVideoDecoderMsg_EmptyThisBuffer,
OnEmptyThisBuffer)
IPC_MESSAGE_HANDLER(GpuVideoDecoderMsg_ProduceVideoFrame,
@@ -87,7 +89,7 @@ void GpuVideoDecoder::OnFlushComplete() {
}
void GpuVideoDecoder::OnSeekComplete() {
- NOTIMPLEMENTED();
+ SendPrerollDone();
}
void GpuVideoDecoder::OnError() {
@@ -200,7 +202,7 @@ void GpuVideoDecoder::Destroy(Task* task) {
}
void GpuVideoDecoder::SetVideoDecodeEngine(media::VideoDecodeEngine* engine) {
- decode_engine_.reset(engine);
+ decode_engine_.reset(engine);
}
void GpuVideoDecoder::SetGpuVideoDevice(GpuVideoDevice* device) {
@@ -244,6 +246,10 @@ void GpuVideoDecoder::OnFlush() {
decode_engine_->Flush();
}
+void GpuVideoDecoder::OnPreroll() {
+ decode_engine_->Seek();
+}
+
void GpuVideoDecoder::OnEmptyThisBuffer(
const GpuVideoDecoderInputBufferParam& buffer) {
DCHECK(input_transfer_buffer_->memory());
@@ -328,6 +334,13 @@ void GpuVideoDecoder::SendFlushDone() {
}
}
+void GpuVideoDecoder::SendPrerollDone() {
+ if (!sender_->Send(new GpuVideoDecoderHostMsg_PrerollDone(
+ decoder_host_id()))) {
+ LOG(ERROR) << "GpuVideoDecoderMsg_PrerollDone failed";
+ }
+}
+
void GpuVideoDecoder::SendEmptyBufferDone() {
if (!sender_->Send(
new GpuVideoDecoderHostMsg_EmptyThisBufferDone(decoder_host_id()))) {
diff --git a/chrome/gpu/gpu_video_decoder.h b/chrome/gpu/gpu_video_decoder.h
index 786e0de..9a339e1 100644
--- a/chrome/gpu/gpu_video_decoder.h
+++ b/chrome/gpu/gpu_video_decoder.h
@@ -149,6 +149,7 @@ class GpuVideoDecoder
void OnInitialize(const GpuVideoDecoderInitParam& param);
void OnUninitialize();
void OnFlush();
+ void OnPreroll();
void OnEmptyThisBuffer(const GpuVideoDecoderInputBufferParam& buffer);
void OnProduceVideoFrame(int32 frame_id);
void OnVideoFrameAllocated(int32 frame_id, std::vector<uint32> textures);
@@ -157,6 +158,7 @@ class GpuVideoDecoder
void SendInitializeDone(const GpuVideoDecoderInitDoneParam& param);
void SendUninitializeDone();
void SendFlushDone();
+ void SendPrerollDone();
void SendEmptyBufferDone();
void SendEmptyBufferACK();
void SendConsumeVideoFrame(int32 frame_id, int64 timestamp, int64 duration,
diff --git a/chrome/gpu/media/fake_gl_video_decode_engine.cc b/chrome/gpu/media/fake_gl_video_decode_engine.cc
index 4badc0e..532434b 100644
--- a/chrome/gpu/media/fake_gl_video_decode_engine.cc
+++ b/chrome/gpu/media/fake_gl_video_decode_engine.cc
@@ -4,6 +4,7 @@
#include "chrome/gpu/media/fake_gl_video_decode_engine.h"
+#include "media/base/limits.h"
#include "media/base/video_frame.h"
#include "media/video/video_decode_context.h"
@@ -37,14 +38,18 @@ void FakeGlVideoDecodeEngine::Initialize(
// Use VideoDecodeContext to allocate VideoFrame that can be consumed by
// external body.
+ // TODO(hclam): It is horrible to use constants everywhere in the code!
+ // The number of frames come from VideoRendererBase in the renderer, this is
+ // horrible!
context_->AllocateVideoFrames(
- 1, width_, height_, media::VideoFrame::RGBA, &external_frames_,
+ media::Limits::kMaxVideoFrames, width_, height_, media::VideoFrame::RGBA,
+ &external_frames_,
NewRunnableMethod(this,
&FakeGlVideoDecodeEngine::AllocationCompleteTask));
}
void FakeGlVideoDecodeEngine::AllocationCompleteTask() {
- DCHECK_EQ(1u, external_frames_.size());
+ DCHECK(media::Limits::kMaxVideoFrames == external_frames_.size());
DCHECK_EQ(media::VideoFrame::TYPE_GL_TEXTURE, external_frames_[0]->type());
media::VideoCodecInfo info;
@@ -66,22 +71,27 @@ void FakeGlVideoDecodeEngine::Flush() {
}
void FakeGlVideoDecodeEngine::Seek() {
+ // TODO(hclam): This is a big hack to continue playing because we need to
+ // *push* decoded frames to downstream. The model used in VideoRendererBase
+ // to wait for *push* is flawed.
+ for (size_t i = 0; i < external_frames_.size(); ++i)
+ handler_->ConsumeVideoFrame(external_frames_[i]);
handler_->OnSeekComplete();
}
void FakeGlVideoDecodeEngine::ConsumeVideoSample(
- scoped_refptr<media::Buffer> buffer) {
- // Don't care.
-}
+ scoped_refptr<media::Buffer> sample) {
+ DCHECK(!pending_frames_.empty());
+ scoped_refptr<media::VideoFrame> frame = pending_frames_.front();
+ pending_frames_.pop();
-void FakeGlVideoDecodeEngine::ProduceVideoFrame(
- scoped_refptr<media::VideoFrame> frame) {
- // Fake that we need some buffer.
- handler_->ProduceVideoSample(NULL);
+ frame->SetDuration(sample->GetDuration());
+ frame->SetTimestamp(sample->GetTimestamp());
+ // Generate a pattern to the internal frame and then uploads it.
int size = width_ * height_ * 4;
scoped_array<uint8> buffer(new uint8[size]);
- memset(buffer.get(), 0, size);
+ memset(buffer.get(), 255, size);
uint8* row = internal_frame_->data(media::VideoFrame::kRGBPlane);
static int seed = 0;
@@ -89,7 +99,7 @@ void FakeGlVideoDecodeEngine::ProduceVideoFrame(
for (int y = 0; y < height_; ++y) {
int offset = y % 3;
for (int x = 0; x < width_; ++x) {
- row[x * 4 + offset] = seed++;
+ row[x * 4 + offset + 1] = seed++;
seed &= 255;
}
row += width_ * 4;
@@ -99,9 +109,18 @@ void FakeGlVideoDecodeEngine::ProduceVideoFrame(
// After we have filled the content upload the internal frame to the
// VideoFrame allocated through VideoDecodeContext.
context_->UploadToVideoFrame(
- internal_frame_, external_frames_[0],
+ internal_frame_, frame,
NewRunnableMethod(this, &FakeGlVideoDecodeEngine::UploadCompleteTask,
- external_frames_[0]));
+ frame));
+}
+
+void FakeGlVideoDecodeEngine::ProduceVideoFrame(
+ scoped_refptr<media::VideoFrame> frame) {
+ // Enqueue the frame to the pending queue.
+ pending_frames_.push(frame);
+
+ // Fake that we need some buffer.
+ handler_->ProduceVideoSample(NULL);
}
void FakeGlVideoDecodeEngine::UploadCompleteTask(
diff --git a/chrome/gpu/media/fake_gl_video_decode_engine.h b/chrome/gpu/media/fake_gl_video_decode_engine.h
index 164c8c4..24d3b33 100644
--- a/chrome/gpu/media/fake_gl_video_decode_engine.h
+++ b/chrome/gpu/media/fake_gl_video_decode_engine.h
@@ -5,6 +5,7 @@
#ifndef CHROME_GPU_MEDIA_FAKE_GL_VIDEO_DECODE_ENGINE_H_
#define CHROME_GPU_MEDIA_FAKE_GL_VIDEO_DECODE_ENGINE_H_
+#include <queue>
#include <vector>
#include "base/scoped_ptr.h"
@@ -53,6 +54,10 @@ class FakeGlVideoDecodeEngine : public media::VideoDecodeEngine {
// opaque to us. And we need an extra upload step.
std::vector<scoped_refptr<media::VideoFrame> > external_frames_;
+ // These are the video frames that are waiting for input buffer to generate
+ // fake pattern in them.
+ std::queue<scoped_refptr<media::VideoFrame> > pending_frames_;
+
DISALLOW_COPY_AND_ASSIGN(FakeGlVideoDecodeEngine);
};
diff --git a/chrome/renderer/ggl/ggl.cc b/chrome/renderer/ggl/ggl.cc
index efe2072..1a0e6e9 100644
--- a/chrome/renderer/ggl/ggl.cc
+++ b/chrome/renderer/ggl/ggl.cc
@@ -13,7 +13,6 @@
#include "chrome/renderer/gpu_channel_host.h"
#include "chrome/renderer/gpu_video_service_host.h"
#include "chrome/renderer/media/gles2_video_decode_context.h"
-#include "chrome/renderer/render_thread.h"
#include "chrome/renderer/render_widget.h"
#include "ipc/ipc_channel_handle.h"
@@ -105,7 +104,8 @@ class Context : public base::SupportsWeakPtr<Context> {
media::VideoDecodeEngine* CreateVideoDecodeEngine();
// Create a hardware video decode context associated with this context.
- media::VideoDecodeContext* CreateVideoDecodeContext(bool hardware_decoder);
+ media::VideoDecodeContext* CreateVideoDecodeContext(MessageLoop* message_loop,
+ bool hardware_decoder);
// Get the current error code. Clears context's error code afterwards.
Error GetError();
@@ -372,9 +372,8 @@ media::VideoDecodeEngine* Context::CreateVideoDecodeEngine() {
}
media::VideoDecodeContext* Context::CreateVideoDecodeContext(
- bool hardware_decoder) {
- return new Gles2VideoDecodeContext(
- RenderThread::current()->message_loop(), hardware_decoder, this);
+ MessageLoop* message_loop, bool hardware_decoder) {
+ return new Gles2VideoDecodeContext(message_loop, hardware_decoder, this);
}
Error Context::GetError() {
@@ -526,8 +525,8 @@ media::VideoDecodeEngine* CreateVideoDecodeEngine(Context* context) {
}
media::VideoDecodeContext* CreateVideoDecodeContext(
- Context* context, bool hardware_decoder) {
- return context->CreateVideoDecodeContext(hardware_decoder);
+ Context* context, MessageLoop* message_loop, bool hardware_decoder) {
+ return context->CreateVideoDecodeContext(message_loop, hardware_decoder);
}
Error GetError() {
diff --git a/chrome/renderer/ggl/ggl.h b/chrome/renderer/ggl/ggl.h
index 8368ab3..b535306 100644
--- a/chrome/renderer/ggl/ggl.h
+++ b/chrome/renderer/ggl/ggl.h
@@ -16,6 +16,7 @@
#include "gfx/size.h"
class GpuChannelHost;
+class MessageLoop;
namespace media {
@@ -144,8 +145,9 @@ media::VideoDecodeEngine* CreateVideoDecodeEngine(Context* context);
// decode engine. It can also be used with a software decode engine.
//
// Set |hardware_decoder| to true if this context is for a hardware video
-// engine.
+// engine. |message_loop| is where the decode context should run on.
media::VideoDecodeContext* CreateVideoDecodeContext(Context* context,
+ MessageLoop* message_loop,
bool hardware_decoder);
// TODO(gman): Remove this
diff --git a/chrome/renderer/gpu_video_decoder_host.cc b/chrome/renderer/gpu_video_decoder_host.cc
index 4a97702..ad81004 100644
--- a/chrome/renderer/gpu_video_decoder_host.cc
+++ b/chrome/renderer/gpu_video_decoder_host.cc
@@ -40,6 +40,8 @@ void GpuVideoDecoderHost::OnMessageReceived(const IPC::Message& msg) {
OnUninitializeDone)
IPC_MESSAGE_HANDLER(GpuVideoDecoderHostMsg_FlushACK,
OnFlushDone)
+ IPC_MESSAGE_HANDLER(GpuVideoDecoderHostMsg_PrerollDone,
+ OnPrerollDone)
IPC_MESSAGE_HANDLER(GpuVideoDecoderHostMsg_EmptyThisBufferACK,
OnEmptyThisBufferACK)
IPC_MESSAGE_HANDLER(GpuVideoDecoderHostMsg_EmptyThisBufferDone,
@@ -169,7 +171,17 @@ void GpuVideoDecoderHost::Flush() {
}
void GpuVideoDecoderHost::Seek() {
- // TODO(hclam): Implement.
+ if (MessageLoop::current() != message_loop_) {
+ message_loop_->PostTask(
+ FROM_HERE, NewRunnableMethod(this, &GpuVideoDecoderHost::Seek));
+ return;
+ }
+
+ if (!ipc_sender_->Send(new GpuVideoDecoderMsg_Preroll(decoder_id_))) {
+ LOG(ERROR) << "GpuVideoDecoderMsg_Preroll failed";
+ event_handler_->OnError();
+ return;
+ }
}
void GpuVideoDecoderHost::OnCreateVideoDecoderDone(int32 decoder_id) {
@@ -228,6 +240,13 @@ void GpuVideoDecoderHost::OnFlushDone() {
event_handler_->OnFlushComplete();
}
+void GpuVideoDecoderHost::OnPrerollDone() {
+ DCHECK_EQ(message_loop_, MessageLoop::current());
+
+ state_ = kStateNormal;
+ event_handler_->OnSeekComplete();
+}
+
void GpuVideoDecoderHost::OnEmptyThisBufferACK() {
DCHECK_EQ(message_loop_, MessageLoop::current());
diff --git a/chrome/renderer/gpu_video_decoder_host.h b/chrome/renderer/gpu_video_decoder_host.h
index e5a26fd..5ca520e 100644
--- a/chrome/renderer/gpu_video_decoder_host.h
+++ b/chrome/renderer/gpu_video_decoder_host.h
@@ -75,6 +75,7 @@ class GpuVideoDecoderHost : public media::VideoDecodeEngine,
void OnInitializeDone(const GpuVideoDecoderInitDoneParam& param);
void OnUninitializeDone();
void OnFlushDone();
+ void OnPrerollDone();
void OnEmptyThisBufferACK();
void OnProduceVideoSample();
void OnConsumeVideoFrame(int32 frame_id, int64 timestamp,
diff --git a/chrome/renderer/gpu_video_service_host.cc b/chrome/renderer/gpu_video_service_host.cc
index d47e309..9c4f433 100644
--- a/chrome/renderer/gpu_video_service_host.cc
+++ b/chrome/renderer/gpu_video_service_host.cc
@@ -54,11 +54,10 @@ void GpuVideoServiceHost::OnGpuChannelConnected(
GpuVideoDecoderHost* GpuVideoServiceHost::CreateVideoDecoder(
int context_route_id) {
- DCHECK(RenderThread::current());
-
GpuVideoDecoderHost* host = new GpuVideoDecoderHost(router_, channel_host_,
context_route_id,
next_decoder_host_id_);
+ // TODO(hclam): Handle thread safety of incrementing the ID.
++next_decoder_host_id_;
return host;
}
diff --git a/chrome/renderer/media/gles2_video_decode_context.cc b/chrome/renderer/media/gles2_video_decode_context.cc
index 1ae31f2..bd60ea1 100644
--- a/chrome/renderer/media/gles2_video_decode_context.cc
+++ b/chrome/renderer/media/gles2_video_decode_context.cc
@@ -25,14 +25,14 @@ void* Gles2VideoDecodeContext::GetDevice() {
}
void Gles2VideoDecodeContext::AllocateVideoFrames(
- int frames_num, size_t width, size_t height,
+ int num_frames, size_t width, size_t height,
media::VideoFrame::Format format,
std::vector<scoped_refptr<media::VideoFrame> >* frames_out, Task* task) {
if (MessageLoop::current() != message_loop_) {
message_loop_->PostTask(
FROM_HERE,
NewRunnableMethod(this, &Gles2VideoDecodeContext::AllocateVideoFrames,
- frames_num, width, height, format, frames_out,
+ num_frames, width, height, format, frames_out,
task));
return;
}
@@ -43,8 +43,8 @@ void Gles2VideoDecodeContext::AllocateVideoFrames(
bool ret = ggl::MakeCurrent(context_);
CHECK(ret) << "Failed to switch context";
- frames_.resize(frames_num);
- for (int i = 0; i < frames_num; ++i) {
+ frames_.resize(num_frames);
+ for (int i = 0; i < num_frames; ++i) {
int planes = media::VideoFrame::GetNumberOfPlanes(format);
media::VideoFrame::GlTexture textures[media::VideoFrame::kMaxPlanes];
@@ -61,6 +61,7 @@ void Gles2VideoDecodeContext::AllocateVideoFrames(
glTexImage2D(GL_TEXTURE_2D, 0, gl_format, width, height, 0, gl_format,
GL_UNSIGNED_BYTE, NULL);
}
+ glFlush();
scoped_refptr<media::VideoFrame> frame;
media::VideoFrame::CreateFrameGlTexture(format, width, height, textures,
diff --git a/chrome/renderer/media/ipc_video_decoder.cc b/chrome/renderer/media/ipc_video_decoder.cc
index 57a7dde..c8f8096 100644
--- a/chrome/renderer/media/ipc_video_decoder.cc
+++ b/chrome/renderer/media/ipc_video_decoder.cc
@@ -56,7 +56,10 @@ void IpcVideoDecoder::Initialize(media::DemuxerStream* demuxer_stream,
// Create a video decode context that assocates with the graphics
// context.
- decode_context_.reset(ggl::CreateVideoDecodeContext(ggl_context_, true));
+ // TODO(hclam): Need to define a message loop that hosts decode context.
+ decode_context_.reset(
+ ggl::CreateVideoDecodeContext(
+ ggl_context_, decode_engine_message_loop_, true));
// Create a hardware video decoder handle.
decode_engine_.reset(ggl::CreateVideoDecodeEngine(ggl_context_));
@@ -104,6 +107,10 @@ void IpcVideoDecoder::OnInitializeComplete(const media::VideoCodecInfo& info) {
if (info.success) {
media_format_.SetAsString(media::MediaFormat::kMimeType,
media::mime_type::kUncompressedVideo);
+ media_format_.SetAsInteger(media::MediaFormat::kSurfaceType,
+ media::VideoFrame::TYPE_GL_TEXTURE);
+ media_format_.SetAsInteger(media::MediaFormat::kSurfaceFormat,
+ info.stream_info.surface_format);
media_format_.SetAsInteger(media::MediaFormat::kWidth,
info.stream_info.surface_width);
media_format_.SetAsInteger(media::MediaFormat::kHeight,
@@ -201,6 +208,5 @@ bool IpcVideoDecoder::IsMediaFormatSupported(const media::MediaFormat& format) {
// TODO(jiesun): Although we current only support H264 hardware decoding,
// in the future, we should query GpuVideoService for capabilities.
int codec_id;
- return format.GetAsInteger(media::MediaFormat::kFFmpegCodecID, &codec_id) &&
- codec_id == CODEC_ID_H264;
+ return format.GetAsInteger(media::MediaFormat::kFFmpegCodecID, &codec_id);
}
diff --git a/chrome/renderer/media/ipc_video_decoder.h b/chrome/renderer/media/ipc_video_decoder.h
index b47e1ab..d0aba70 100644
--- a/chrome/renderer/media/ipc_video_decoder.h
+++ b/chrome/renderer/media/ipc_video_decoder.h
@@ -50,6 +50,8 @@ class IpcVideoDecoder : public media::VideoDecoder,
virtual void OnFlushComplete();
virtual void OnSeekComplete();
virtual void OnError();
+
+ // TODO(hclam): Remove this method.
virtual void OnFormatChange(media::VideoStreamInfo stream_info) {}
virtual void ProduceVideoSample(scoped_refptr<media::Buffer> buffer);
virtual void ConsumeVideoFrame(scoped_refptr<media::VideoFrame> frame);
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 9c078661..b164a39 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -62,6 +62,7 @@
#include "chrome/renderer/extensions/renderer_extension_bindings.h"
#include "chrome/renderer/external_host_bindings.h"
#include "chrome/renderer/geolocation_dispatcher.h"
+#include "chrome/renderer/ggl/ggl.h"
#include "chrome/renderer/localized_error.h"
#include "chrome/renderer/media/audio_renderer_impl.h"
#include "chrome/renderer/media/ipc_video_decoder.h"
@@ -116,6 +117,7 @@
#include "third_party/WebKit/WebKit/chromium/public/WebFormControlElement.h"
#include "third_party/WebKit/WebKit/chromium/public/WebFormElement.h"
#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebGraphicsContext3D.h"
#include "third_party/WebKit/WebKit/chromium/public/WebHistoryItem.h"
#include "third_party/WebKit/WebKit/chromium/public/WebImage.h"
#include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h"
@@ -2465,6 +2467,19 @@ WebMediaPlayer* RenderView::createMediaPlayer(
AudioRendererImpl::CreateFactory(audio_message_filter()));
}
+ if (cmd_line->HasSwitch(switches::kEnableAcceleratedDecoding) &&
+ !cmd_line->HasSwitch(switches::kDisableAcceleratedCompositing)) {
+ // Add the hardware video decoder factory.
+ // TODO(hclam): This assumes that ggl::Context is set to current
+ // internally. I need to make it more explicit to get the context.
+ bool ret = frame->view()->graphicsContext3D()->makeContextCurrent();
+ CHECK(ret) << "Failed to switch context";
+
+ factory->AddFactory(IpcVideoDecoder::CreateFactory(
+ MessageLoop::current(),
+ ggl::GetCurrentContext()));
+ }
+
WebApplicationCacheHostImpl* appcache_host =
WebApplicationCacheHostImpl::FromFrame(frame);
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
index 1752a4d..797481b 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -220,8 +220,6 @@ void FFmpegDemuxerStream::EnableBitstreamConverter() {
filter_name = "vc1_asftorcv";
} else if (stream_->codec->codec_id == CODEC_ID_VC1) {
filter_name = "vc1_asftoannexg";
- } else {
- NOTREACHED();
}
if (filter_name) {
diff --git a/webkit/glue/webvideoframe_impl.cc b/webkit/glue/webvideoframe_impl.cc
index f50eded..4d1cd72 100644
--- a/webkit/glue/webvideoframe_impl.cc
+++ b/webkit/glue/webvideoframe_impl.cc
@@ -90,7 +90,7 @@ const void* WebVideoFrameImpl::data(unsigned plane) const {
unsigned WebVideoFrameImpl::texture(unsigned plane) const {
if (video_frame_.get())
return video_frame_->gl_texture(plane);
- return NULL;
+ return 0;
}
} // namespace webkit_glue