Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: content/common/gpu/media/omx_video_decode_accelerator.cc

Issue 7311004: Destroy egl image handles in the end of playback. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/common/gpu/media/omx_video_decode_accelerator.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/gpu/media/omx_video_decode_accelerator.h" 5 #include "content/common/gpu/media/omx_video_decode_accelerator.h"
6 6
7 #include "base/stl_util-inl.h" 7 #include "base/stl_util-inl.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "content/common/gpu/gpu_channel.h" 9 #include "content/common/gpu/gpu_channel.h"
10 #include "content/common/gpu/media/gles2_texture_to_egl_image_translator.h" 10 #include "content/common/gpu/media/gles2_texture_to_egl_image_translator.h"
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 DCHECK(!pictures_.empty()); 693 DCHECK(!pictures_.empty());
694 gfx::Size decoded_pixel_size(pictures_.begin()->second.gles_buffer.size()); 694 gfx::Size decoded_pixel_size(pictures_.begin()->second.gles_buffer.size());
695 gfx::Size visible_pixel_size(pictures_.begin()->second.gles_buffer.size()); 695 gfx::Size visible_pixel_size(pictures_.begin()->second.gles_buffer.size());
696 for (OutputPictureById::iterator it = pictures_.begin(); 696 for (OutputPictureById::iterator it = pictures_.begin();
697 it != pictures_.end(); ++it) { 697 it != pictures_.end(); ++it) {
698 media::GLESBuffer& gles_buffer = it->second.gles_buffer; 698 media::GLESBuffer& gles_buffer = it->second.gles_buffer;
699 OMX_BUFFERHEADERTYPE** omx_buffer = &it->second.omx_buffer_header; 699 OMX_BUFFERHEADERTYPE** omx_buffer = &it->second.omx_buffer_header;
700 DCHECK(!*omx_buffer); 700 DCHECK(!*omx_buffer);
701 void* egl = texture2eglImage_translator.TranslateToEglImage( 701 void* egl = texture2eglImage_translator.TranslateToEglImage(
702 egl_display_, egl_context_, gles_buffer.texture_id()); 702 egl_display_, egl_context_, gles_buffer.texture_id());
703 egl_images_.push_back(egl);
703 OMX_ERRORTYPE result = OMX_UseEGLImage( 704 OMX_ERRORTYPE result = OMX_UseEGLImage(
704 component_handle_, omx_buffer, output_port_, &gles_buffer, egl); 705 component_handle_, omx_buffer, output_port_, &gles_buffer, egl);
705 if (result != OMX_ErrorNone) { 706 if (result != OMX_ErrorNone) {
706 LOG(ERROR) << "OMX_UseEGLImage failed with: " << result; 707 LOG(ERROR) << "OMX_UseEGLImage failed with: " << result;
707 return false; 708 return false;
708 } 709 }
709 // Here we set a garbage bitstream buffer id, and then overwrite it before 710 // Here we set a garbage bitstream buffer id, and then overwrite it before
710 // passing to PictureReady. 711 // passing to PictureReady.
711 int garbage_bitstream_buffer_id = -1; 712 int garbage_bitstream_buffer_id = -1;
712 (*omx_buffer)->pAppPrivate = 713 (*omx_buffer)->pAppPrivate =
(...skipping 30 matching lines...) Expand all
743 delete reinterpret_cast<media::Picture*>(omx_buffer->pAppPrivate); 744 delete reinterpret_cast<media::Picture*>(omx_buffer->pAppPrivate);
744 result = OMX_FreeBuffer(component_handle_, output_port_, omx_buffer); 745 result = OMX_FreeBuffer(component_handle_, output_port_, omx_buffer);
745 if (result != OMX_ErrorNone) { 746 if (result != OMX_ErrorNone) {
746 LOG(ERROR) << "OMX_FreeBuffer failed with: " << result; 747 LOG(ERROR) << "OMX_FreeBuffer failed with: " << result;
747 StopOnError(VIDEODECODERERROR_INVALIDINPUT); 748 StopOnError(VIDEODECODERERROR_INVALIDINPUT);
748 return; 749 return;
749 } 750 }
750 client_->DismissPictureBuffer(it->first); 751 client_->DismissPictureBuffer(it->first);
751 } 752 }
752 pictures_.clear(); 753 pictures_.clear();
754
755 static Gles2TextureToEglImageTranslator texture2eglImage_translator;
756 for (size_t i = 0; i < egl_images_.size(); ++i) {
757 texture2eglImage_translator.DestroyEglImage(egl_display_, egl_images_[i]);
Ami GONE FROM CHROMIUM 2011/07/06 15:52:38 This is a bit late to delete the image, as the und
vhiremath 2011/07/07 06:00:37 Done.
758 }
753 } 759 }
754 760
755 void OmxVideoDecodeAccelerator::OnIndexParamPortDefinitionChanged(int port) { 761 void OmxVideoDecodeAccelerator::OnIndexParamPortDefinitionChanged(int port) {
756 DCHECK_EQ(port, output_port_); 762 DCHECK_EQ(port, output_port_);
757 DCHECK(!on_port_disable_event_func_); 763 DCHECK(!on_port_disable_event_func_);
758 on_port_disable_event_func_ = 764 on_port_disable_event_func_ =
759 &OmxVideoDecodeAccelerator::PortDisabledForSettingsChange; 765 &OmxVideoDecodeAccelerator::PortDisabledForSettingsChange;
760 ChangePort(OMX_CommandPortDisable, port); 766 ChangePort(OMX_CommandPortDisable, port);
761 } 767 }
762 768
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 OMX_ERRORTYPE result = OMX_SendCommand(component_handle_, 1036 OMX_ERRORTYPE result = OMX_SendCommand(component_handle_,
1031 cmd, port_index, 0); 1037 cmd, port_index, 0);
1032 if (result != OMX_ErrorNone) { 1038 if (result != OMX_ErrorNone) {
1033 LOG(ERROR) << "SendCommand() failed" << cmd << ":" << result; 1039 LOG(ERROR) << "SendCommand() failed" << cmd << ":" << result;
1034 StopOnError(VIDEODECODERERROR_INVALIDINPUT); 1040 StopOnError(VIDEODECODERERROR_INVALIDINPUT);
1035 return; 1041 return;
1036 } 1042 }
1037 } 1043 }
1038 1044
1039 DISABLE_RUNNABLE_METHOD_REFCOUNT(OmxVideoDecodeAccelerator); 1045 DISABLE_RUNNABLE_METHOD_REFCOUNT(OmxVideoDecodeAccelerator);
OLDNEW
« no previous file with comments | « content/common/gpu/media/omx_video_decode_accelerator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698