Index: content/common/gpu/media/omx_video_decode_accelerator.cc |
=================================================================== |
--- content/common/gpu/media/omx_video_decode_accelerator.cc (revision 120554) |
+++ content/common/gpu/media/omx_video_decode_accelerator.cc (working copy) |
@@ -10,10 +10,13 @@ |
#include "base/stl_util.h" |
#include "base/string_util.h" |
#include "content/common/gpu/gpu_channel.h" |
-#include "content/common/gpu/media/gles2_texture_to_egl_image_translator.h" |
#include "media/base/bitstream_buffer.h" |
#include "media/video/picture.h" |
+#if (defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)) |
Ami GONE FROM CHROMIUM
2012/02/18 00:00:25
No other configuration builds this .cc file so IMO
|
+#include "ui/gfx/gl/gl_surface_egl.h" |
+#endif |
+ |
// Helper typedef for input buffers. This is used as the pAppPrivate field of |
// OMX_BUFFERHEADERTYPEs of input buffers, to point to the data associated with |
// them. |
@@ -109,9 +112,12 @@ |
input_buffers_at_component_(0), |
output_port_(0), |
output_buffers_at_component_(0), |
+ width_(-1), |
+ height_(-1), |
client_(client), |
profile_(OMX_VIDEO_AVCProfileMax), |
- component_name_is_nvidia_h264ext_(false) { |
+ component_name_is_nvidia_h264ext_(false), |
+ component_name_is_sec_h264ext_(false) { |
RETURN_ON_FAILURE(AreOMXFunctionPointersInitialized(), |
"Failed to load openmax library", PLATFORM_FAILURE,); |
RETURN_ON_OMX_FAILURE(omx_init(), "Failed to init OpenMAX core", |
@@ -199,6 +205,10 @@ |
reinterpret_cast<char *>(component.get()), |
"OMX.Nvidia.h264ext.decode"); |
+ component_name_is_sec_h264ext_ = !strcmp( |
+ reinterpret_cast<char *>(component.get()), |
+ "OMX.SEC.AVC.Decoder"); |
+ |
// Get the port information. This will obtain information about the number of |
// ports and index of the first port. |
OMX_PORT_PARAM_TYPE port_param; |
@@ -344,10 +354,16 @@ |
DCHECK_EQ(fake_output_buffers_.size(), 0U); |
DCHECK_EQ(pictures_.size(), 0U); |
- static Gles2TextureToEglImageTranslator texture2eglImage_translator; |
+ Display* x_display = NULL; |
+ if (component_name_is_sec_h264ext_) |
+ x_display = gfx::GLSurfaceEGL::GetNativeDisplay(); |
+ |
+ texture2eglImage_translator_ = |
Ami GONE FROM CHROMIUM
2012/02/18 00:00:25
This is leaking a translator per call to AssignPic
|
+ new Gles2TextureToEglImageTranslator(x_display); |
for (size_t i = 0; i < buffers.size(); ++i) { |
- EGLImageKHR egl_image = texture2eglImage_translator.TranslateToEglImage( |
- egl_display_, egl_context_, buffers[i].texture_id()); |
+ EGLImageKHR egl_image = texture2eglImage_translator_->TranslateToEglImage( |
+ egl_display_, egl_context_, |
+ buffers[i].texture_id(), width_, height_); |
CHECK(pictures_.insert(std::make_pair( |
buffers[i].id(), OutputPicture(buffers[i], NULL, egl_image))).second); |
} |
@@ -696,7 +712,6 @@ |
DCHECK_EQ(message_loop_, MessageLoop::current()); |
// Calls to OMX to free buffers. |
OMX_ERRORTYPE result; |
- static Gles2TextureToEglImageTranslator texture2eglImage_translator; |
for (OutputPictureById::iterator it = pictures_.begin(); |
it != pictures_.end(); ++it) { |
OMX_BUFFERHEADERTYPE* omx_buffer = it->second.omx_buffer_header; |
@@ -704,8 +719,8 @@ |
delete reinterpret_cast<media::Picture*>(omx_buffer->pAppPrivate); |
result = OMX_FreeBuffer(component_handle_, output_port_, omx_buffer); |
RETURN_ON_OMX_FAILURE(result, "OMX_FreeBuffer", PLATFORM_FAILURE,); |
- texture2eglImage_translator.DestroyEglImage(egl_display_, |
- it->second.egl_image); |
+ texture2eglImage_translator_->DestroyEglImage(egl_display_, |
+ it->second.egl_image); |
if (client_) |
client_->DismissPictureBuffer(it->first); |
} |
@@ -730,6 +745,9 @@ |
// ProvidePictureBuffers() will trigger AssignPictureBuffers, which ultimately |
// assigns the textures to the component and re-enables the port. |
const OMX_VIDEO_PORTDEFINITIONTYPE& vformat = port_format.format.video; |
+ width_ = vformat.nFrameWidth; |
+ height_ = vformat.nFrameHeight; |
+ |
if (client_) { |
client_->ProvidePictureBuffers( |
kNumPictureBuffers, |