Commit ee2a19b1 authored by fischman@chromium.org's avatar fischman@chromium.org

Revert 86681 - Updated OMX decoder for recent PPAPI changes, and added to the build.

Had to move from content/gpu to content/common/gpu to allow gpu_video_service.cc
to depend on the decoder.
Removed some dead code and did some random cleanup while I was in there.

BUG=none
TEST=chrome compiles on cros/arm!

Review URL: http://codereview.chromium.org/7057027

TBR=fischman@chromium.org
Review URL: http://codereview.chromium.org/6979017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86687 0039d316-1c4b-4281-b951-d872f2087c98
parent 76420799
...@@ -3471,6 +3471,22 @@ ...@@ -3471,6 +3471,22 @@
# '<(DEPTH)/ui/gfx/size.cc', # '<(DEPTH)/ui/gfx/size.cc',
# '<(DEPTH)/ui/gfx/size.h', # '<(DEPTH)/ui/gfx/size.h',
# ], # ],
# 'conditions': [
# ['target_arch=="arm"', {
# 'sources': [
# '<(DEPTH)/content/gpu/gles2_texture_to_egl_image_translator.cc',
# '<(DEPTH)/content/gpu/gles2_texture_to_egl_image_translator.h',
# '<(DEPTH)/content/gpu/omx_video_decode_accelerator.cc',
# '<(DEPTH)/content/gpu/omx_video_decode_accelerator.h',
# ],
# 'link_settings': {
# 'libraries': [
# '-lEGL',
# '-lGLESv2',
# ],
# },
# }],
# ],
# }, # },
{ {
'target_name': 'plugin_tests', 'target_name': 'plugin_tests',
......
...@@ -6,5 +6,4 @@ include_rules = [ ...@@ -6,5 +6,4 @@ include_rules = [
"+media/base", "+media/base",
"+media/video", "+media/video",
"+skia", "+skia",
"+third_party/openmax",
] ]
...@@ -108,7 +108,7 @@ void GpuVideoDecodeAccelerator::OnGetConfigs( ...@@ -108,7 +108,7 @@ void GpuVideoDecodeAccelerator::OnGetConfigs(
void GpuVideoDecodeAccelerator::OnInitialize( void GpuVideoDecodeAccelerator::OnInitialize(
const std::vector<uint32>& configs) { const std::vector<uint32>& configs) {
if (!video_decode_accelerator_.get()) if (!video_decode_accelerator_)
return; return;
video_decode_accelerator_->Initialize(configs); video_decode_accelerator_->Initialize(configs);
...@@ -117,7 +117,7 @@ void GpuVideoDecodeAccelerator::OnInitialize( ...@@ -117,7 +117,7 @@ void GpuVideoDecodeAccelerator::OnInitialize(
void GpuVideoDecodeAccelerator::OnDecode(int32 id, void GpuVideoDecodeAccelerator::OnDecode(int32 id,
base::SharedMemoryHandle handle, base::SharedMemoryHandle handle,
int32 size) { int32 size) {
if (!video_decode_accelerator_.get()) if (!video_decode_accelerator_)
return; return;
video_decode_accelerator_->Decode(media::BitstreamBuffer(id, handle, size)); video_decode_accelerator_->Decode(media::BitstreamBuffer(id, handle, size));
} }
...@@ -140,14 +140,14 @@ void GpuVideoDecodeAccelerator::OnAssignSysmemBuffers( ...@@ -140,14 +140,14 @@ void GpuVideoDecodeAccelerator::OnAssignSysmemBuffers(
} }
void GpuVideoDecodeAccelerator::OnReusePictureBuffer(int32 picture_buffer_id) { void GpuVideoDecodeAccelerator::OnReusePictureBuffer(int32 picture_buffer_id) {
if (!video_decode_accelerator_.get()) if (!video_decode_accelerator_)
return; return;
video_decode_accelerator_->ReusePictureBuffer(picture_buffer_id); video_decode_accelerator_->ReusePictureBuffer(picture_buffer_id);
} }
void GpuVideoDecodeAccelerator::OnFlush() { void GpuVideoDecodeAccelerator::OnFlush() {
if (!video_decode_accelerator_.get()) if (!video_decode_accelerator_)
return; return;
if (!video_decode_accelerator_->Flush()) { if (!video_decode_accelerator_->Flush()) {
...@@ -157,7 +157,7 @@ void GpuVideoDecodeAccelerator::OnFlush() { ...@@ -157,7 +157,7 @@ void GpuVideoDecodeAccelerator::OnFlush() {
} }
void GpuVideoDecodeAccelerator::OnAbort() { void GpuVideoDecodeAccelerator::OnAbort() {
if (!video_decode_accelerator_.get()) if (!video_decode_accelerator_)
return; return;
video_decode_accelerator_->Abort(); video_decode_accelerator_->Abort();
......
...@@ -45,8 +45,7 @@ class GpuVideoDecodeAccelerator ...@@ -45,8 +45,7 @@ class GpuVideoDecodeAccelerator
void set_video_decode_accelerator( void set_video_decode_accelerator(
media::VideoDecodeAccelerator* accelerator) { media::VideoDecodeAccelerator* accelerator) {
DCHECK(!video_decode_accelerator_.get()); video_decode_accelerator_ = accelerator;
video_decode_accelerator_.reset(accelerator);
} }
private: private:
...@@ -73,7 +72,7 @@ class GpuVideoDecodeAccelerator ...@@ -73,7 +72,7 @@ class GpuVideoDecodeAccelerator
int32 route_id_; int32 route_id_;
// Pointer to the underlying VideoDecodeAccelerator. // Pointer to the underlying VideoDecodeAccelerator.
scoped_ptr<media::VideoDecodeAccelerator> video_decode_accelerator_; media::VideoDecodeAccelerator* video_decode_accelerator_;
DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator); DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator);
}; };
......
...@@ -8,10 +8,6 @@ ...@@ -8,10 +8,6 @@
#include "content/common/gpu/gpu_messages.h" #include "content/common/gpu/gpu_messages.h"
#include "content/common/gpu/gpu_video_decode_accelerator.h" #include "content/common/gpu/gpu_video_decode_accelerator.h"
#if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)
#include "content/common/gpu/omx_video_decode_accelerator.h"
#endif // defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)
GpuVideoService::GpuVideoService() { GpuVideoService::GpuVideoService() {
// TODO(jiesun): move this time consuming stuff out of here. // TODO(jiesun): move this time consuming stuff out of here.
IntializeGpuVideoService(); IntializeGpuVideoService();
...@@ -61,10 +57,6 @@ bool GpuVideoService::CreateVideoDecoder( ...@@ -61,10 +57,6 @@ bool GpuVideoService::CreateVideoDecoder(
// Create GpuVideoDecodeAccelerator and add to map. // Create GpuVideoDecodeAccelerator and add to map.
scoped_refptr<GpuVideoDecodeAccelerator> decoder = scoped_refptr<GpuVideoDecodeAccelerator> decoder =
new GpuVideoDecodeAccelerator(channel, decoder_host_id); new GpuVideoDecodeAccelerator(channel, decoder_host_id);
#if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)
decoder->set_video_decode_accelerator(
new OmxVideoDecodeAccelerator(decoder, MessageLoop::current()));
#endif // defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)
bool result = decoder_map_.insert(std::make_pair(decoder_id, decoder)).second; bool result = decoder_map_.insert(std::make_pair(decoder_id, decoder)).second;
......
...@@ -289,23 +289,6 @@ ...@@ -289,23 +289,6 @@
'../gpu/gpu.gyp:command_buffer_service', '../gpu/gpu.gyp:command_buffer_service',
], ],
}], }],
['target_arch=="arm"', {
'sources': [
'common/gpu/gles2_texture_to_egl_image_translator.cc',
'common/gpu/gles2_texture_to_egl_image_translator.h',
'common/gpu/omx_video_decode_accelerator.cc',
'common/gpu/omx_video_decode_accelerator.h',
],
'include_dirs': [
'<(DEPTH)/third_party/openmax/il',
],
'link_settings': {
'libraries': [
'-lEGL',
'-lGLESv2',
],
},
}],
], ],
}, },
], ],
......
...@@ -8,4 +8,5 @@ include_rules = [ ...@@ -8,4 +8,5 @@ include_rules = [
"+media/video", "+media/video",
"+sandbox", "+sandbox",
"+skia", "+skia",
"+third_party/openmax",
] ]
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "content/common/gpu/gles2_texture_to_egl_image_translator.h" #include "content/gpu/gles2_texture_to_egl_image_translator.h"
#include "base/logging.h"
// Get EGL extension functions. // Get EGL extension functions.
static PFNEGLCREATEIMAGEKHRPROC egl_create_image_khr = static PFNEGLCREATEIMAGEKHRPROC egl_create_image_khr =
...@@ -71,3 +69,5 @@ void Gles2TextureToEglImageTranslator::DestroyEglImage(EGLImageKHR egl_image) { ...@@ -71,3 +69,5 @@ void Gles2TextureToEglImageTranslator::DestroyEglImage(EGLImageKHR egl_image) {
} }
egl_destroy_image_khr(egl_display_, egl_image); egl_destroy_image_khr(egl_display_, egl_image);
} }
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CONTENT_COMMON_GPU_GLES2_TEXTURE_TO_EGL_IMAGE_TRANSLATOR_H_ #ifndef CONTENT_GPU_GLES2_TEXTURE_TO_EGL_IMAGE_TRANSLATOR_H_
#define CONTENT_COMMON_GPU_GLES2_TEXTURE_TO_EGL_IMAGE_TRANSLATOR_H_ #define CONTENT_GPU_GLES2_TEXTURE_TO_EGL_IMAGE_TRANSLATOR_H_
#include <EGL/egl.h> #include <EGL/egl.h>
#include <EGL/eglext.h> #include <EGL/eglext.h>
...@@ -36,4 +36,6 @@ class Gles2TextureToEglImageTranslator { ...@@ -36,4 +36,6 @@ class Gles2TextureToEglImageTranslator {
DISALLOW_IMPLICIT_CONSTRUCTORS(Gles2TextureToEglImageTranslator); DISALLOW_IMPLICIT_CONSTRUCTORS(Gles2TextureToEglImageTranslator);
}; };
#endif // CONTENT_COMMON_GPU_GLES2_TEXTURE_TO_EGL_IMAGE_TRANSLATOR_H_ #endif // CONTENT_GPU_GLES2_TEXTURE_TO_EGL_IMAGE_TRANSLATOR_H_
...@@ -2,15 +2,17 @@ ...@@ -2,15 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "content/common/gpu/omx_video_decode_accelerator.h" #include "content/gpu/omx_video_decode_accelerator.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
#include "content/common/gpu/gles2_texture_to_egl_image_translator.h"
#include "content/common/gpu/gpu_channel.h" #include "content/common/gpu/gpu_channel.h"
#include "content/common/gpu_messages.h"
#include "content/gpu/gles2_texture_to_egl_image_translator.h"
#include "media/base/bitstream_buffer.h" #include "media/base/bitstream_buffer.h"
#include "media/base/data_buffer.h"
#include "media/video/picture.h" #include "media/video/picture.h"
static Gles2TextureToEglImageTranslator* texture2eglImage_translator(
new Gles2TextureToEglImageTranslator(NULL, 0));
enum { kNumPictureBuffers = 4 }; enum { kNumPictureBuffers = 4 };
// Open the libnvomx here for now. // Open the libnvomx here for now.
...@@ -24,6 +26,7 @@ typedef OMX_ERRORTYPE (*OMXFreeHandle)(OMX_HANDLETYPE); ...@@ -24,6 +26,7 @@ typedef OMX_ERRORTYPE (*OMXFreeHandle)(OMX_HANDLETYPE);
typedef OMX_ERRORTYPE (*OMXDeinit)(); typedef OMX_ERRORTYPE (*OMXDeinit)();
OMXInit omx_init = reinterpret_cast<OMXInit>(dlsym(omx_handle, "OMX_Init")); OMXInit omx_init = reinterpret_cast<OMXInit>(dlsym(omx_handle, "OMX_Init"));
OMXGetHandle omx_gethandle = OMXGetHandle omx_gethandle =
reinterpret_cast<OMXGetHandle>(dlsym(omx_handle, "OMX_GetHandle")); reinterpret_cast<OMXGetHandle>(dlsym(omx_handle, "OMX_GetHandle"));
OMXGetComponentsOfRole omx_get_components_of_role = OMXGetComponentsOfRole omx_get_components_of_role =
...@@ -55,7 +58,8 @@ OmxVideoDecodeAccelerator::OmxVideoDecodeAccelerator( ...@@ -55,7 +58,8 @@ OmxVideoDecodeAccelerator::OmxVideoDecodeAccelerator(
output_port_(0), output_port_(0),
output_buffers_at_component_(0), output_buffers_at_component_(0),
uses_egl_image_(false), uses_egl_image_(false),
client_(client) { client_(client),
egl_image_(NULL) {
if (!AreOMXFunctionPointersInitialized()) { if (!AreOMXFunctionPointersInitialized()) {
LOG(ERROR) << "Failed to load openmax library"; LOG(ERROR) << "Failed to load openmax library";
return; return;
...@@ -72,11 +76,11 @@ OmxVideoDecodeAccelerator::~OmxVideoDecodeAccelerator() { ...@@ -72,11 +76,11 @@ OmxVideoDecodeAccelerator::~OmxVideoDecodeAccelerator() {
DCHECK(output_pictures_.empty()); DCHECK(output_pictures_.empty());
} }
void OmxVideoDecodeAccelerator::GetConfigs( const std::vector<uint32>& OmxVideoDecodeAccelerator::GetConfig(
const std::vector<uint32>& requested_configs, const std::vector<uint32>& prototype_config) {
std::vector<uint32>* matched_configs) {
// TODO(vhiremath@nvidia.com) use this properly // TODO(vhiremath@nvidia.com) use this properly
NOTIMPLEMENTED(); NOTIMPLEMENTED();
return component_config_;
} }
// This is to initialize the OMX data structures to default values. // This is to initialize the OMX data structures to default values.
...@@ -88,7 +92,7 @@ static void InitParam(const OmxVideoDecodeAccelerator& dec, T* param) { ...@@ -88,7 +92,7 @@ static void InitParam(const OmxVideoDecodeAccelerator& dec, T* param) {
} }
bool OmxVideoDecodeAccelerator::Initialize(const std::vector<uint32>& config) { bool OmxVideoDecodeAccelerator::Initialize(const std::vector<uint32>& config) {
// TODO(vhiremath@nvidia.com) get these actual values from config // TODO(vhiremath@nvidia.com) get these acutal values from config
// Assume qvga for now // Assume qvga for now
width_ = 320; width_ = 320;
height_ = 240; height_ = 240;
...@@ -118,17 +122,12 @@ bool OmxVideoDecodeAccelerator::Initialize(const std::vector<uint32>& config) { ...@@ -118,17 +122,12 @@ bool OmxVideoDecodeAccelerator::Initialize(const std::vector<uint32>& config) {
// - SharedMemHandle in case of decoding to system memory. // - SharedMemHandle in case of decoding to system memory.
// - Textures in case of decoding to egl-images. // - Textures in case of decoding to egl-images.
// Output buffers will be eventually handed to us via // Output buffers will be eventually allocated in AssignPictureBuffer().
// Assign{GLES,Sysmem}Buffers().
// TODO(vhiremath@nvidia.com) fill buffer_properties
std::vector<uint32> buffer_properties;
output_buffer_count_ = kNumPictureBuffers; output_buffer_count_ = kNumPictureBuffers;
client_->ProvidePictureBuffers( client_->ProvidePictureBuffers(output_buffer_count_, buffer_properties);
output_buffer_count_, gfx::Size(width_, height_),
PICTUREBUFFER_MEMORYTYPE_GL_TEXTURE);
// TODO(fischman): we always ask for GLES buffers above. So why maintain the
// !uses_egl_image_ path in this class at all? Theoretically it could be
// useful for testing, but today there's no such testing. Consider ripping it
// out of this class and replacing AssignSysmemBuffers() with
// NOTIMPLEMENTED().
return true; return true;
} }
...@@ -249,8 +248,10 @@ bool OmxVideoDecodeAccelerator::CreateComponent() { ...@@ -249,8 +248,10 @@ bool OmxVideoDecodeAccelerator::CreateComponent() {
} }
bool OmxVideoDecodeAccelerator::Decode( bool OmxVideoDecodeAccelerator::Decode(
const media::BitstreamBuffer& bitstream_buffer) { const media::BitstreamBuffer& bitstream_buffer,
const media::VideoDecodeAcceleratorCallback& callback) {
DCHECK(!free_input_buffers_.empty()); DCHECK(!free_input_buffers_.empty());
DCHECK(bitstream_buffer);
if (!CanAcceptInput()) { if (!CanAcceptInput()) {
return false; return false;
...@@ -267,7 +268,7 @@ bool OmxVideoDecodeAccelerator::Decode( ...@@ -267,7 +268,7 @@ bool OmxVideoDecodeAccelerator::Decode(
return false; return false;
} }
omx_buffer->pBuffer = static_cast<OMX_U8*>(shm->memory()); omx_buffer->pBuffer = static_cast<OMX_U8*>(shm->memory());
omx_buffer->nFilledLen = bitstream_buffer.size(); omx_buffer->nFilledLen = bitstream_buffer->size();
omx_buffer->nAllocLen = omx_buffer->nFilledLen; omx_buffer->nAllocLen = omx_buffer->nFilledLen;
omx_buffer->nFlags &= ~OMX_BUFFERFLAG_EOS; omx_buffer->nFlags &= ~OMX_BUFFERFLAG_EOS;
...@@ -284,35 +285,25 @@ bool OmxVideoDecodeAccelerator::Decode( ...@@ -284,35 +285,25 @@ bool OmxVideoDecodeAccelerator::Decode(
input_buffers_at_component_++; input_buffers_at_component_++;
// OMX_EmptyThisBuffer is a non blocking call and should // OMX_EmptyThisBuffer is a non blocking call and should
// not make any assumptions about its completion. // not make any assumptions about its completion.
omx_buff_ids_.insert(std::make_pair( omx_buff_cb_.insert(std::make_pair(
omx_buffer, std::make_pair(shm.release(), bitstream_buffer.id()))); omx_buffer, make_pair(shm.release(), callback)));
return true; return true;
} }
// NOTE: this is only partially-implemented as never unsets uses_egl_image_ once void OmxVideoDecodeAccelerator::AssignPictureBuffer(
// set. std::vector<PictureBuffer*> picture_buffers) {
void OmxVideoDecodeAccelerator::AssignGLESBuffers( // NOTE: this is only partially-implemented as it only inspects the first
const std::vector<media::GLESBuffer>& buffers) { // picture buffer passed in each AssignPictureBuffer call, and never unsets
uses_egl_image_ = true; // uses_egl_image_ once set.
std::vector<media::BaseBuffer*> base_buffers(buffers.size()); if (PictureBuffer::PICTUREBUFFER_MEMORYTYPE_GL_TEXTURE ==
for (size_t i = 0; i < buffers.size(); ++i) picture_buffers[0]->GetMemoryType()) {
base_buffers[i] = new media::GLESBuffer(buffers[i]); uses_egl_image_ = true;
AssignBuffersHelper(base_buffers); }
}
void OmxVideoDecodeAccelerator::AssignSysmemBuffers(
const std::vector<media::SysmemBuffer>& buffers) {
DCHECK(!uses_egl_image_);
std::vector<media::BaseBuffer*> base_buffers(buffers.size());
for (size_t i = 0; i < buffers.size(); ++i)
base_buffers[i] = new media::SysmemBuffer(buffers[i]);
AssignBuffersHelper(base_buffers);
}
void OmxVideoDecodeAccelerator::AssignBuffersHelper(
const std::vector<media::BaseBuffer*>& buffers) {
assigned_picture_buffers_.insert( assigned_picture_buffers_.insert(
assigned_picture_buffers_.end(), buffers.begin(), buffers.end()); assigned_picture_buffers_.end(),
picture_buffers.begin(),
picture_buffers.end());
if (assigned_picture_buffers_.size() < kNumPictureBuffers) if (assigned_picture_buffers_.size() < kNumPictureBuffers)
return; // get all the buffers first. return; // get all the buffers first.
...@@ -365,7 +356,7 @@ void OmxVideoDecodeAccelerator::ReusePictureBuffer(int32 picture_buffer_id) { ...@@ -365,7 +356,7 @@ void OmxVideoDecodeAccelerator::ReusePictureBuffer(int32 picture_buffer_id) {
return; return;
for (int i = 0; i < output_buffer_count_; ++i) { for (int i = 0; i < output_buffer_count_; ++i) {
if (picture_buffer_id != assigned_picture_buffers_[i]->id()) if (picture_buffer_id != assigned_picture_buffers_[i]->GetId())
continue; continue;
output_buffers_at_component_++; output_buffers_at_component_++;
OMX_ERRORTYPE result = OMX_ERRORTYPE result =
...@@ -399,15 +390,17 @@ void OmxVideoDecodeAccelerator::InitialFillBuffer() { ...@@ -399,15 +390,17 @@ void OmxVideoDecodeAccelerator::InitialFillBuffer() {
} }
} }
bool OmxVideoDecodeAccelerator::Flush() { bool OmxVideoDecodeAccelerator::Flush(
const media::VideoDecodeAcceleratorCallback& callback) {
OMX_STATETYPE il_state; OMX_STATETYPE il_state;
OMX_GetState(component_handle_, &il_state); OMX_GetState(component_handle_, &il_state);
DCHECK_EQ(il_state, OMX_StateExecuting); DCHECK_EQ(il_state, OMX_StateExecuting);
if (il_state != OMX_StateExecuting) { if (il_state != OMX_StateExecuting) {
client_->NotifyFlushDone(); callback.Run();
return false; return false;
} }
on_buffer_flag_event_func_ = &OmxVideoDecodeAccelerator::FlushBegin; on_buffer_flag_event_func_ = &OmxVideoDecodeAccelerator::FlushBegin;
flush_done_callback_ = callback;
OMX_BUFFERHEADERTYPE* omx_buffer = free_input_buffers_.front(); OMX_BUFFERHEADERTYPE* omx_buffer = free_input_buffers_.front();
free_input_buffers_.pop(); free_input_buffers_.pop();
...@@ -485,12 +478,13 @@ void OmxVideoDecodeAccelerator::PortFlushDone(int port) { ...@@ -485,12 +478,13 @@ void OmxVideoDecodeAccelerator::PortFlushDone(int port) {
OnPortCommandFlush(OMX_StateExecuting); OnPortCommandFlush(OMX_StateExecuting);
} }
bool OmxVideoDecodeAccelerator::Abort() { bool OmxVideoDecodeAccelerator::Abort(
const media::VideoDecodeAcceleratorCallback& callback) {
// TODO(vhiremath@nvidia.com) // TODO(vhiremath@nvidia.com)
// Need more thinking on this to handle w.r.t OMX. // Need more thinking on this to handle w.r.t OMX.
// There is no explicit UnInitialize call for this. // There is no explicit UnInitialize call for this.
// Also review again for trick modes. // Also review again for trick modes.
client_->NotifyAbortDone(); callback.Run();
return true; return true;
} }
...@@ -515,6 +509,7 @@ void OmxVideoDecodeAccelerator::OnStateChangeIdleToExecuting( ...@@ -515,6 +509,7 @@ void OmxVideoDecodeAccelerator::OnStateChangeIdleToExecuting(
client_state_ = OMX_StateExecuting; client_state_ = OMX_StateExecuting;
on_state_event_func_ = NULL; on_state_event_func_ = NULL;
// This will kickoff the actual decoding // This will kickoff the actual decoding
client_->NotifyResourcesAcquired();
InitialFillBuffer(); InitialFillBuffer();
} }
...@@ -542,7 +537,6 @@ void OmxVideoDecodeAccelerator::OnPortCommandFlush(OMX_STATETYPE state) { ...@@ -542,7 +537,6 @@ void OmxVideoDecodeAccelerator::OnPortCommandFlush(OMX_STATETYPE state) {
OutputPicture output_picture = output_pictures_[i]; OutputPicture output_picture = output_pictures_[i];
client_->DismissPictureBuffer(output_picture.first); client_->DismissPictureBuffer(output_picture.first);
} }
STLDeleteElements(&assigned_picture_buffers_);
} }
void OmxVideoDecodeAccelerator::OnStateChangeExecutingToIdle( void OmxVideoDecodeAccelerator::OnStateChangeExecutingToIdle(
...@@ -575,7 +569,7 @@ void OmxVideoDecodeAccelerator::OnStateChangeIdleToLoaded(OMX_STATETYPE state) { ...@@ -575,7 +569,7 @@ void OmxVideoDecodeAccelerator::OnStateChangeIdleToLoaded(OMX_STATETYPE state) {
client_state_ = OMX_StateLoaded; client_state_ = OMX_StateLoaded;
(*omx_deinit)(); (*omx_deinit)();
VLOG(1) << "OMX Deinit Clean exit done"; VLOG(1) << "OMX Deinit Clean exit done";
client_->NotifyFlushDone(); flush_done_callback_.Run();
} }
void OmxVideoDecodeAccelerator::StopOnError() { void OmxVideoDecodeAccelerator::StopOnError() {
...@@ -617,49 +611,62 @@ bool OmxVideoDecodeAccelerator::AllocateInputBuffers() { ...@@ -617,49 +611,62 @@ bool OmxVideoDecodeAccelerator::AllocateInputBuffers() {
} }
bool OmxVideoDecodeAccelerator::AllocateOutputBuffers() { bool OmxVideoDecodeAccelerator::AllocateOutputBuffers() {
static Gles2TextureToEglImageTranslator* texture2eglImage_translator( OMX_BUFFERHEADERTYPE* buffer;
new Gles2TextureToEglImageTranslator(NULL, 0)); Picture* picture;
OMX_ERRORTYPE result;
gfx::Size decoded_pixel_size(width_, height_); gfx::Size decoded_pixel_size(width_, height_);
gfx::Size visible_pixel_size(width_, height_); gfx::Size visible_pixel_size(width_, height_);
// TODO(fischman): remove garbage bitstream buffer id's below (42 and 24) when
// the bitstream_buffer_id field is removed from Picture.
if (uses_egl_image_) { if (uses_egl_image_) {
media::VideoDecodeAccelerator::PictureBuffer::DataPlaneHandle egl_ids;
std::vector<PictureBuffer::DataPlaneHandle> planes;
uint32 texture;
for (uint32 i = 0; i < assigned_picture_buffers_.size(); i++) { for (uint32 i = 0; i < assigned_picture_buffers_.size(); i++) {
media::GLESBuffer* gles_buffer = picture = new media::Picture(
reinterpret_cast<media::GLESBuffer*>(assigned_picture_buffers_[i]); reinterpret_cast<media::PictureBuffer*>(assigned_picture_buffers_[i]),
OMX_BUFFERHEADERTYPE* omx_buffer; decoded_pixel_size, visible_pixel_size,
void* egl = texture2eglImage_translator->TranslateToEglImage( static_cast<void*>(component_handle_));
gles_buffer->texture_id());
OMX_ERRORTYPE result = OMX_UseEGLImage( planes = assigned_picture_buffers_[i]->GetPlaneHandles();
component_handle_, &omx_buffer, output_port_, gles_buffer, egl); egl_ids = planes[i];
texture = egl_ids.texture_id;
egl_image_ = texture2eglImage_translator->TranslateToEglImage(texture);
result = OMX_UseEGLImage(
component_handle_,
&buffer,
output_port_,
reinterpret_cast<media::PictureBuffer*>(assigned_picture_buffers_[i]),
egl_image_);
if (result != OMX_ErrorNone) { if (result != OMX_ErrorNone) {
LOG(ERROR) << "OMX_UseEGLImage failed"; LOG(ERROR) << "OMX_UseEGLImage failed";
return false; return false;
} }
omx_buffer->pAppPrivate =
new media::Picture(gles_buffer->id(),
42 /* garbage bitstreambuffer id */,
decoded_pixel_size, visible_pixel_size);
output_pictures_.push_back( output_pictures_.push_back(
std::make_pair(assigned_picture_buffers_[i]->id(), omx_buffer)); std::make_pair(
reinterpret_cast<media::PictureBuffer*>(
assigned_picture_buffers_[i]),
buffer));
buffer->pAppPrivate = picture;
} }
} else { } else {
for (uint32 i = 0; i < assigned_picture_buffers_.size(); i++) { for (uint32 i = 0; i < assigned_picture_buffers_.size(); i++) {
media::SysmemBuffer* sysmem_buffer = picture = new media::Picture(
reinterpret_cast<media::SysmemBuffer*>(assigned_picture_buffers_[i]); reinterpret_cast<media::PictureBuffer*>(assigned_picture_buffers_[i]),
OMX_BUFFERHEADERTYPE* omx_buffer; decoded_pixel_size, visible_pixel_size,
OMX_ERRORTYPE result = OMX_AllocateBuffer( static_cast<void*>(component_handle_));
component_handle_, &omx_buffer, output_port_, NULL,
output_buffer_size_); result = OMX_AllocateBuffer(component_handle_, &buffer, output_port_,
NULL, output_buffer_size_);
if (result != OMX_ErrorNone) if (result != OMX_ErrorNone)
return false; return false;
omx_buffer->pAppPrivate = new media::Picture(
sysmem_buffer->id(),
24 /* garbage bitstreambuffer id */,
decoded_pixel_size, visible_pixel_size);
output_pictures_.push_back( output_pictures_.push_back(
std::make_pair(sysmem_buffer->id(), omx_buffer)); std::make_pair(
reinterpret_cast<media::PictureBuffer*>(
assigned_picture_buffers_[i]),
buffer));
buffer->pAppPrivate = picture;
} }
} }
return true; return true;
...@@ -687,7 +694,6 @@ void OmxVideoDecodeAccelerator::FreeOutputBuffers() { ...@@ -687,7 +694,6 @@ void OmxVideoDecodeAccelerator::FreeOutputBuffers() {
for (size_t i = 0; i < output_pictures_.size(); ++i) { for (size_t i = 0; i < output_pictures_.size(); ++i) {
OMX_BUFFERHEADERTYPE* omx_buffer = output_pictures_[i].second; OMX_BUFFERHEADERTYPE* omx_buffer = output_pictures_[i].second;
CHECK(omx_buffer); CHECK(omx_buffer);
delete reinterpret_cast<media::Picture*>(omx_buffer->pAppPrivate);
result = OMX_FreeBuffer(component_handle_, output_port_, omx_buffer); result = OMX_FreeBuffer(component_handle_, output_port_, omx_buffer);
if (result != OMX_ErrorNone) { if (result != OMX_ErrorNone) {
LOG(ERROR) << "SendCommand(OMX_CommandPortDisable) failed"; LOG(ERROR) << "SendCommand(OMX_CommandPortDisable) failed";
...@@ -713,8 +719,7 @@ void OmxVideoDecodeAccelerator::FillBufferDoneTask( ...@@ -713,8 +719,7 @@ void OmxVideoDecodeAccelerator::FillBufferDoneTask(
OMX_BUFFERHEADERTYPE* buffer) { OMX_BUFFERHEADERTYPE* buffer) {
DCHECK_GT(output_buffers_at_component_, 0); DCHECK_GT(output_buffers_at_component_, 0);
output_buffers_at_component_--; output_buffers_at_component_--;
client_->PictureReady(*reinterpret_cast<media::Picture*>( client_->PictureReady(reinterpret_cast<Picture*>(buffer->pAppPrivate));
buffer->pAppPrivate));
} }
void OmxVideoDecodeAccelerator::EmptyBufferDoneTask( void OmxVideoDecodeAccelerator::EmptyBufferDoneTask(
...@@ -724,17 +729,16 @@ void OmxVideoDecodeAccelerator::EmptyBufferDoneTask( ...@@ -724,17 +729,16 @@ void OmxVideoDecodeAccelerator::EmptyBufferDoneTask(
input_buffers_at_component_--; input_buffers_at_component_--;
if (buffer->nFlags & OMX_BUFFERFLAG_EOS) if (buffer->nFlags & OMX_BUFFERFLAG_EOS)
return; return;
// Retrieve the corresponding BitstreamBuffer's id and notify the client of // Retrieve the corresponding callback and run it.
// its completion. OMXBufferCallbackMap::iterator it = omx_buff_cb_.find(buffer);
OMXBufferIdMap::iterator it = omx_buff_ids_.find(buffer); if (it == omx_buff_cb_.end()) {
if (it == omx_buff_ids_.end()) { LOG(ERROR) << "Unexpectedly failed to find a buffer callback.";
LOG(ERROR) << "Unexpectedly failed to find a buffer id.";
StopOnError(); StopOnError();
return; return;
} }
delete it->second.first; delete it->second.first;
client_->NotifyEndOfBitstreamBuffer(it->second.second); it->second.second.Run();
omx_buff_ids_.erase(it); omx_buff_cb_.erase(it);
} }
void OmxVideoDecodeAccelerator::EventHandlerCompleteTask(OMX_EVENTTYPE event, void OmxVideoDecodeAccelerator::EventHandlerCompleteTask(OMX_EVENTTYPE event,
...@@ -806,11 +810,10 @@ OMX_ERRORTYPE OmxVideoDecodeAccelerator::EventHandler(OMX_HANDLETYPE component, ...@@ -806,11 +810,10 @@ OMX_ERRORTYPE OmxVideoDecodeAccelerator::EventHandler(OMX_HANDLETYPE component,
static_cast<OmxVideoDecodeAccelerator*>(priv_data); static_cast<OmxVideoDecodeAccelerator*>(priv_data);
DCHECK_EQ(component, decoder->component_handle_); DCHECK_EQ(component, decoder->component_handle_);
decoder->message_loop_->PostTask( decoder->message_loop_->PostTask(FROM_HERE,
FROM_HERE, NewRunnableMethod(decoder,
NewRunnableMethod(decoder, &OmxVideoDecodeAccelerator::EventHandlerCompleteTask,
&OmxVideoDecodeAccelerator::EventHandlerCompleteTask, event, data1, data2));
event, data1, data2));
return OMX_ErrorNone; return OMX_ErrorNone;
} }
...@@ -841,8 +844,7 @@ OMX_ERRORTYPE OmxVideoDecodeAccelerator::FillBufferCallback( ...@@ -841,8 +844,7 @@ OMX_ERRORTYPE OmxVideoDecodeAccelerator::FillBufferCallback(
static_cast<OmxVideoDecodeAccelerator*>(priv_data); static_cast<OmxVideoDecodeAccelerator*>(priv_data);
DCHECK_EQ(component, decoder->component_handle_); DCHECK_EQ(component, decoder->component_handle_);
decoder->message_loop_->PostTask( decoder->message_loop_->PostTask(FROM_HERE,
FROM_HERE,
NewRunnableMethod( NewRunnableMethod(
decoder, decoder,
&OmxVideoDecodeAccelerator::FillBufferDoneTask, buffer)); &OmxVideoDecodeAccelerator::FillBufferDoneTask, buffer));
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CONTENT_COMMON_GPU_OMX_VIDEO_DECODE_ACCELERATOR_H_ #ifndef CONTENT_GPU_OMX_VIDEO_DECODE_ACCELERATOR_H_
#define CONTENT_COMMON_GPU_OMX_VIDEO_DECODE_ACCELERATOR_H_ #define CONTENT_GPU_OMX_VIDEO_DECODE_ACCELERATOR_H_
#include <dlfcn.h> #include <dlfcn.h>
#include <map> #include <map>
...@@ -30,25 +30,20 @@ class OmxVideoDecodeAccelerator : public media::VideoDecodeAccelerator { ...@@ -30,25 +30,20 @@ class OmxVideoDecodeAccelerator : public media::VideoDecodeAccelerator {
virtual ~OmxVideoDecodeAccelerator(); virtual ~OmxVideoDecodeAccelerator();
// media::VideoDecodeAccelerator implementation. // media::VideoDecodeAccelerator implementation.
void GetConfigs(const std::vector<uint32>& requested_configs, const std::vector<uint32>& GetConfig(
std::vector<uint32>* matched_configs) OVERRIDE; const std::vector<uint32>& prototype_config);
bool Initialize(const std::vector<uint32>& config) OVERRIDE; bool Initialize(const std::vector<uint32>& config);
bool Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; bool Decode(const media::BitstreamBuffer& bitstream_buffer,
virtual void AssignGLESBuffers( const media::VideoDecodeAcceleratorCallback& callback);
const std::vector<media::GLESBuffer>& buffers) OVERRIDE; void AssignPictureBuffer(std::vector<PictureBuffer*> picture_buffers);
virtual void AssignSysmemBuffers( void ReusePictureBuffer(int32 picture_buffer_id);
const std::vector<media::SysmemBuffer>& buffers) OVERRIDE; bool Flush(const media::VideoDecodeAcceleratorCallback& callback);
void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; bool Abort(const media::VideoDecodeAcceleratorCallback& callback);
bool Flush() OVERRIDE;
bool Abort() OVERRIDE;
private: private:
MessageLoop* message_loop_; MessageLoop* message_loop_;
OMX_HANDLETYPE component_handle_; OMX_HANDLETYPE component_handle_;
// Common initialization code for Assign{GLES,Sysmem}Buffers.
void AssignBuffersHelper(const std::vector<media::BaseBuffer*>& buffers);
// Create the Component for OMX. Handles all OMX initialization. // Create the Component for OMX. Handles all OMX initialization.
bool CreateComponent(); bool CreateComponent();
// Buffer allocation/free methods for input and output buffers. // Buffer allocation/free methods for input and output buffers.
...@@ -107,13 +102,18 @@ class OmxVideoDecodeAccelerator : public media::VideoDecodeAccelerator { ...@@ -107,13 +102,18 @@ class OmxVideoDecodeAccelerator : public media::VideoDecodeAccelerator {
std::queue<OMX_BUFFERHEADERTYPE*> free_input_buffers_; std::queue<OMX_BUFFERHEADERTYPE*> free_input_buffers_;
// For output buffer recycling cases. // For output buffer recycling cases.
std::vector<media::BaseBuffer*> assigned_picture_buffers_; std::vector<media::VideoDecodeAccelerator::PictureBuffer*>
typedef std::pair<int32, OMX_BUFFERHEADERTYPE*> OutputPicture; assigned_picture_buffers_;
typedef std::pair<PictureBuffer*,
OMX_BUFFERHEADERTYPE*> OutputPicture;
std::vector<OutputPicture> output_pictures_; std::vector<OutputPicture> output_pictures_;
// To expose client callbacks from VideoDecodeAccelerator. // To expose client callbacks from VideoDecodeAccelerator.
Client* client_; Client* client_;
media::VideoDecodeAcceleratorCallback flush_done_callback_;
media::VideoDecodeAcceleratorCallback abort_done_callback_;
std::vector<uint32> texture_ids_; std::vector<uint32> texture_ids_;
std::vector<uint32> context_ids_; std::vector<uint32> context_ids_;
// Method to handle events // Method to handle events
...@@ -127,10 +127,14 @@ class OmxVideoDecodeAccelerator : public media::VideoDecodeAccelerator { ...@@ -127,10 +127,14 @@ class OmxVideoDecodeAccelerator : public media::VideoDecodeAccelerator {
// Method to receive buffers from component's output port // Method to receive buffers from component's output port
void FillBufferDoneTask(OMX_BUFFERHEADERTYPE* buffer); void FillBufferDoneTask(OMX_BUFFERHEADERTYPE* buffer);
typedef std::pair<OMX_BUFFERHEADERTYPE*, uint32> OMXbufferTexture; typedef std::pair<OMX_BUFFERHEADERTYPE*, uint32> OMXbufferTexture;
// void pointer to hold EGLImage handle.
void* egl_image_;
typedef std::map<OMX_BUFFERHEADERTYPE*, typedef std::map<
std::pair<base::SharedMemory*, int32> > OMXBufferIdMap; OMX_BUFFERHEADERTYPE*,
OMXBufferIdMap omx_buff_ids_; std::pair<base::SharedMemory*,
media::VideoDecodeAcceleratorCallback> > OMXBufferCallbackMap;
OMXBufferCallbackMap omx_buff_cb_;
// Method used the change the state of the port. // Method used the change the state of the port.
void ChangePort(OMX_COMMANDTYPE cmd, int port_index); void ChangePort(OMX_COMMANDTYPE cmd, int port_index);
...@@ -158,4 +162,4 @@ class OmxVideoDecodeAccelerator : public media::VideoDecodeAccelerator { ...@@ -158,4 +162,4 @@ class OmxVideoDecodeAccelerator : public media::VideoDecodeAccelerator {
OMX_BUFFERHEADERTYPE* buffer); OMX_BUFFERHEADERTYPE* buffer);
}; };
#endif // CONTENT_COMMON_GPU_OMX_VIDEO_DECODE_ACCELERATOR_H_ #endif // CONTENT_GPU_OMX_VIDEO_DECODE_ACCELERATOR_H_
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "ipc/ipc_message_utils.h" #include "ipc/ipc_message_utils.h"
using media::VideoDecodeAccelerator; using media::VideoDecodeAccelerator;
using media::VideoDecodeAcceleratorCallback;
GpuVideoDecodeAcceleratorHost::GpuVideoDecodeAcceleratorHost( GpuVideoDecodeAcceleratorHost::GpuVideoDecodeAcceleratorHost(
MessageRouter* router, MessageRouter* router,
...@@ -104,11 +105,11 @@ void GpuVideoDecodeAcceleratorHost::AssignGLESBuffers( ...@@ -104,11 +105,11 @@ void GpuVideoDecodeAcceleratorHost::AssignGLESBuffers(
std::vector<uint32> context_ids; std::vector<uint32> context_ids;
std::vector<gfx::Size> sizes; std::vector<gfx::Size> sizes;
for (uint32 i = 0; i < buffers.size(); i++) { for (uint32 i = 0; i < buffers.size(); i++) {
const media::GLESBuffer& buffer = buffers[i]; const media::BufferInfo& info = buffers[i].buffer_info();
texture_ids.push_back(buffer.texture_id()); texture_ids.push_back(buffers[i].texture_id());
context_ids.push_back(buffer.context_id()); context_ids.push_back(buffers[i].context_id());
buffer_ids.push_back(buffer.id()); buffer_ids.push_back(info.id());
sizes.push_back(buffer.size()); sizes.push_back(info.size());
} }
if (!ipc_sender_->Send(new AcceleratedVideoDecoderMsg_AssignGLESBuffers( if (!ipc_sender_->Send(new AcceleratedVideoDecoderMsg_AssignGLESBuffers(
decoder_id_, buffer_ids, texture_ids, context_ids, sizes))) { decoder_id_, buffer_ids, texture_ids, context_ids, sizes))) {
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "content/renderer/render_thread.h" #include "content/renderer/render_thread.h"
using media::BitstreamBuffer; using media::BitstreamBuffer;
using media::VideoDecodeAcceleratorCallback;
PlatformVideoDecoderImpl::PlatformVideoDecoderImpl( PlatformVideoDecoderImpl::PlatformVideoDecoderImpl(
VideoDecodeAccelerator::Client* client) VideoDecodeAccelerator::Client* client)
......
...@@ -6,22 +6,25 @@ ...@@ -6,22 +6,25 @@
namespace media { namespace media {
BaseBuffer::~BaseBuffer() {}
// Implementations for the other constructors are found in // Implementations for the other constructors are found in
// webkit/plugins/ppapi/ppb_video_decoder_impl.cc. // webkit/plugins/ppapi/ppb_video_decoder_impl.cc.
// They are not included in this file because it would require // They are not included in this file because it would require
// media/ to depend on files in ppapi/. // media/ to depend on files in ppapi/.
BaseBuffer::BaseBuffer(int32 id, gfx::Size size) : id_(id), size_(size) { BufferInfo::BufferInfo(int32 id, gfx::Size size)
: id_(id),
size_(size) {
} }
GLESBuffer::GLESBuffer( GLESBuffer::GLESBuffer(
int32 id, gfx::Size size, uint32 texture_id, uint32 context_id) int32 id, gfx::Size size, uint32 texture_id, uint32 context_id)
: BaseBuffer(id, size), texture_id_(texture_id), context_id_(context_id) { : texture_id_(texture_id),
context_id_(context_id),
info_(id, size) {
} }
SysmemBuffer::SysmemBuffer(int32 id, gfx::Size size, void* data) SysmemBuffer::SysmemBuffer(int32 id, gfx::Size size, void* data)
: BaseBuffer(id, size), data_(data) { : data_(data),
info_(id, size) {
} }
Picture::Picture(int32 picture_buffer_id, int32 bitstream_buffer_id, Picture::Picture(int32 picture_buffer_id, int32 bitstream_buffer_id,
......
...@@ -15,13 +15,12 @@ struct PP_SysmemBuffer_Dev; ...@@ -15,13 +15,12 @@ struct PP_SysmemBuffer_Dev;
namespace media { namespace media {
// Common information about GLES & Sysmem picture buffers. // Information about the picture buffer.
// This is the media-namespace equivalent of PP_BufferInfo_Dev. // This is the media-namespace equivalent of PP_BufferInfo_Dev.
class BaseBuffer { class BufferInfo {
public: public:
BaseBuffer(int32 id, gfx::Size size); BufferInfo(int32 id, gfx::Size size);
BaseBuffer(const PP_BufferInfo_Dev& info); BufferInfo(const PP_BufferInfo_Dev& info);
virtual ~BaseBuffer();
// Returns the client-specified id of the buffer. // Returns the client-specified id of the buffer.
int32 id() const { int32 id() const {
...@@ -40,7 +39,7 @@ class BaseBuffer { ...@@ -40,7 +39,7 @@ class BaseBuffer {
// A picture buffer that is composed of a GLES2 texture and context. // A picture buffer that is composed of a GLES2 texture and context.
// This is the media-namespace equivalent of PP_GLESBuffer_Dev. // This is the media-namespace equivalent of PP_GLESBuffer_Dev.
class GLESBuffer : public BaseBuffer { class GLESBuffer {
public: public:
GLESBuffer(int32 id, gfx::Size size, uint32 texture_id, uint32 context_id); GLESBuffer(int32 id, gfx::Size size, uint32 texture_id, uint32 context_id);
GLESBuffer(const PP_GLESBuffer_Dev& buffer); GLESBuffer(const PP_GLESBuffer_Dev& buffer);
...@@ -57,14 +56,20 @@ class GLESBuffer : public BaseBuffer { ...@@ -57,14 +56,20 @@ class GLESBuffer : public BaseBuffer {
return context_id_; return context_id_;
} }
// Returns information regarding the buffer.
const BufferInfo& buffer_info() const {
return info_;
}
private: private:
uint32 texture_id_; uint32 texture_id_;
uint32 context_id_; uint32 context_id_;
BufferInfo info_;
}; };
// A picture buffer that lives in system memory. // A picture buffer that lives in system memory.
// This is the media-namespace equivalent of PP_SysmemBuffer_Dev. // This is the media-namespace equivalent of PP_SysmemBuffer_Dev.
class SysmemBuffer : public BaseBuffer { class SysmemBuffer {
public: public:
SysmemBuffer(int32 id, gfx::Size size, void* data); SysmemBuffer(int32 id, gfx::Size size, void* data);
SysmemBuffer(const PP_SysmemBuffer_Dev&); SysmemBuffer(const PP_SysmemBuffer_Dev&);
...@@ -74,8 +79,14 @@ class SysmemBuffer : public BaseBuffer { ...@@ -74,8 +79,14 @@ class SysmemBuffer : public BaseBuffer {
return data_; return data_;
} }
// Returns information regarding the buffer.
const BufferInfo& buffer_info() const {
return info_;
}
private: private:
void* data_; void* data_;
BufferInfo info_;
}; };
// A decoded picture frame. // A decoded picture frame.
...@@ -92,9 +103,7 @@ class Picture { ...@@ -92,9 +103,7 @@ class Picture {
} }
// Returns the id of the bitstream buffer from which this frame was decoded. // Returns the id of the bitstream buffer from which this frame was decoded.
// TODO(fischman,vrk): Remove this field; pictures can span arbitrarily many // TODO(vrk): Handle the case where a picture can span multiple buffers.
// BitstreamBuffers, and it's not clear what clients would do with this
// information, anyway.
int32 bitstream_buffer_id() const { int32 bitstream_buffer_id() const {
return bitstream_buffer_id_; return bitstream_buffer_id_;
} }
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
namespace media { namespace media {
typedef Callback0::Type VideoDecodeAcceleratorCallback;
// Enumeration defining global dictionary ranges for various purposes that are // Enumeration defining global dictionary ranges for various purposes that are
// used to handle the configurations of the video decoder. // used to handle the configurations of the video decoder.
enum VideoAttributeKey { enum VideoAttributeKey {
......
...@@ -398,7 +398,7 @@ void PPB_VideoDecoder_Impl::NotifyFlushDone() { ...@@ -398,7 +398,7 @@ void PPB_VideoDecoder_Impl::NotifyFlushDone() {
// These functions are declared in picture.h but are defined here because of // These functions are declared in picture.h but are defined here because of
// dependencies (we can't depend on ppapi types from media). // dependencies (we can't depend on ppapi types from media).
namespace media { namespace media {
BaseBuffer::BaseBuffer(const PP_BufferInfo_Dev& info) BufferInfo::BufferInfo(const PP_BufferInfo_Dev& info)
: id_(info.id), : id_(info.id),
size_(info.size.width, info.size.height) { size_(info.size.width, info.size.height) {
} }
...@@ -406,13 +406,13 @@ BaseBuffer::BaseBuffer(const PP_BufferInfo_Dev& info) ...@@ -406,13 +406,13 @@ BaseBuffer::BaseBuffer(const PP_BufferInfo_Dev& info)
// TODO(vrk): This assigns the PP_Resource context to be // TODO(vrk): This assigns the PP_Resource context to be
// the context_id. Not sure what it's actually supposed to be. // the context_id. Not sure what it's actually supposed to be.
GLESBuffer::GLESBuffer(const PP_GLESBuffer_Dev& buffer) GLESBuffer::GLESBuffer(const PP_GLESBuffer_Dev& buffer)
: BaseBuffer(buffer.info), : texture_id_(buffer.texture_id),
texture_id_(buffer.texture_id), context_id_(buffer.context),
context_id_(buffer.context) { info_(buffer.info) {
} }
SysmemBuffer::SysmemBuffer(const PP_SysmemBuffer_Dev& buffer) SysmemBuffer::SysmemBuffer(const PP_SysmemBuffer_Dev& buffer)
: BaseBuffer(buffer.info) { : info_(buffer.info) {
scoped_refptr<webkit::ppapi::PPB_Buffer_Impl> pepper_buffer = scoped_refptr<webkit::ppapi::PPB_Buffer_Impl> pepper_buffer =
webkit::ppapi::Resource::GetAs<webkit::ppapi::PPB_Buffer_Impl>( webkit::ppapi::Resource::GetAs<webkit::ppapi::PPB_Buffer_Impl>(
buffer.data); buffer.data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment