Chromium Code Reviews| 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) |
| @@ -109,9 +109,11 @@ |
| input_buffers_at_component_(0), |
| output_port_(0), |
| output_buffers_at_component_(0), |
| + last_requested_picture_buffer_dimensions_(gfx::Size(-1, -1)), |
|
Ami GONE FROM CHROMIUM
2012/02/20 16:54:28
gfx::Size()'s default ctor initializes with 0's, a
|
| 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 +201,13 @@ |
| reinterpret_cast<char *>(component.get()), |
| "OMX.Nvidia.h264ext.decode"); |
| + component_name_is_sec_h264ext_ = !strcmp( |
|
Ami GONE FROM CHROMIUM
2012/02/20 16:54:28
In the interest of keeping CL's minimal, can you r
|
| + reinterpret_cast<char *>(component.get()), |
| + "OMX.SEC.AVC.Decoder"); |
| + Gles2TextureToEglImageTranslator* texture_to_egl_image_translator = |
| + new Gles2TextureToEglImageTranslator(component_name_is_sec_h264ext_); |
| + texture_to_egl_image_translator_.reset(texture_to_egl_image_translator); |
| + |
| // 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 +353,12 @@ |
| DCHECK_EQ(fake_output_buffers_.size(), 0U); |
| DCHECK_EQ(pictures_.size(), 0U); |
| - static Gles2TextureToEglImageTranslator texture2eglImage_translator; |
| 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 = |
| + texture_to_egl_image_translator_->TranslateToEglImage( |
|
Ami GONE FROM CHROMIUM
2012/02/20 16:54:28
indentation is wrong here; it should be 4 spaces f
|
| + egl_display_, egl_context_, |
| + buffers[i].texture_id(), |
| + &last_requested_picture_buffer_dimensions_); |
| CHECK(pictures_.insert(std::make_pair( |
| buffers[i].id(), OutputPicture(buffers[i], NULL, egl_image))).second); |
| } |
| @@ -696,7 +707,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 +714,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); |
| + texture_to_egl_image_translator_->DestroyEglImage(egl_display_, |
| + it->second.egl_image); |
|
Ami GONE FROM CHROMIUM
2012/02/20 16:54:28
indent is off
|
| if (client_) |
| client_->DismissPictureBuffer(it->first); |
| } |
| @@ -730,6 +740,8 @@ |
| // 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; |
| + last_requested_picture_buffer_dimensions_.SetSize(vformat.nFrameWidth, |
| + vformat.nFrameHeight); |
| if (client_) { |
| client_->ProvidePictureBuffers( |
| kNumPictureBuffers, |