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

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

Issue 7545014: Implement PPAPI VideoDecode out-of-process support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: responding to brettw Created 9 years, 4 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
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.h" 7 #include "base/stl_util.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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 92 }
93 93
94 void OmxVideoDecodeAccelerator::SetEglState( 94 void OmxVideoDecodeAccelerator::SetEglState(
95 EGLDisplay egl_display, EGLContext egl_context) { 95 EGLDisplay egl_display, EGLContext egl_context) {
96 DCHECK_EQ(message_loop_, MessageLoop::current()); 96 DCHECK_EQ(message_loop_, MessageLoop::current());
97 egl_display_ = egl_display; 97 egl_display_ = egl_display;
98 egl_context_ = egl_context; 98 egl_context_ = egl_context;
99 } 99 }
100 100
101 bool OmxVideoDecodeAccelerator::VerifyConfigs( 101 bool OmxVideoDecodeAccelerator::VerifyConfigs(
102 const std::vector<uint32>& configs) { 102 const std::vector<int32>& configs) {
103 size_t cur; 103 size_t cur;
104 for (cur = 0; cur + 1 < configs.size(); cur++) { 104 for (cur = 0; cur + 1 < configs.size(); cur++) {
105 uint32 n = configs[cur++]; 105 uint32 n = configs[cur++];
106 uint32 v = configs[cur]; 106 uint32 v = configs[cur];
107 if ((n == media::VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_FOURCC && 107 if ((n == media::VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_FOURCC &&
108 v == media::VIDEOCODECFOURCC_H264) || 108 v == media::VIDEOCODECFOURCC_H264) ||
109 (n == media::VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_BITRATE && 109 (n == media::VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_BITRATE &&
110 v < 14000000 /* Baseline supports up to 14Mbps. */) || 110 v < 14000000 /* Baseline supports up to 14Mbps. */) ||
111 (n == media::VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_WIDTH && 111 (n == media::VIDEOATTRIBUTEKEY_BITSTREAMFORMAT_WIDTH &&
112 v <= 1920 /* Baseline supports upto 1080p. */) || 112 v <= 1920 /* Baseline supports upto 1080p. */) ||
(...skipping 21 matching lines...) Expand all
134 } 134 }
135 135
136 // This is to initialize the OMX data structures to default values. 136 // This is to initialize the OMX data structures to default values.
137 template <typename T> 137 template <typename T>
138 static void InitParam(const OmxVideoDecodeAccelerator& dec, T* param) { 138 static void InitParam(const OmxVideoDecodeAccelerator& dec, T* param) {
139 memset(param, 0, sizeof(T)); 139 memset(param, 0, sizeof(T));
140 param->nVersion.nVersion = 0x00000101; 140 param->nVersion.nVersion = 0x00000101;
141 param->nSize = sizeof(T); 141 param->nSize = sizeof(T);
142 } 142 }
143 143
144 bool OmxVideoDecodeAccelerator::Initialize(const std::vector<uint32>& config) { 144 bool OmxVideoDecodeAccelerator::Initialize(const std::vector<int32>& config) {
145 DCHECK_EQ(message_loop_, MessageLoop::current()); 145 DCHECK_EQ(message_loop_, MessageLoop::current());
146 RETURN_ON_FAILURE(VerifyConfigs(config), "Invalid config", INVALID_ARGUMENT, 146 RETURN_ON_FAILURE(VerifyConfigs(config), "Invalid config", INVALID_ARGUMENT,
147 false); 147 false);
148 if (!CreateComponent()) // Does its own RETURN_ON_FAILURE dances. 148 if (!CreateComponent()) // Does its own RETURN_ON_FAILURE dances.
149 return false; 149 return false;
150 150
151 DCHECK_EQ(current_state_change_, NO_TRANSITION); 151 DCHECK_EQ(current_state_change_, NO_TRANSITION);
152 current_state_change_ = INITIALIZING; 152 current_state_change_ = INITIALIZING;
153 BeginTransitionToState(OMX_StateIdle); 153 BeginTransitionToState(OMX_StateIdle);
154 154
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 1011
1012 bool OmxVideoDecodeAccelerator::SendCommandToPort( 1012 bool OmxVideoDecodeAccelerator::SendCommandToPort(
1013 OMX_COMMANDTYPE cmd, int port_index) { 1013 OMX_COMMANDTYPE cmd, int port_index) {
1014 DCHECK_EQ(message_loop_, MessageLoop::current()); 1014 DCHECK_EQ(message_loop_, MessageLoop::current());
1015 OMX_ERRORTYPE result = OMX_SendCommand(component_handle_, 1015 OMX_ERRORTYPE result = OMX_SendCommand(component_handle_,
1016 cmd, port_index, 0); 1016 cmd, port_index, 0);
1017 RETURN_ON_OMX_FAILURE(result, "SendCommand() failed" << cmd, 1017 RETURN_ON_OMX_FAILURE(result, "SendCommand() failed" << cmd,
1018 PLATFORM_FAILURE, false); 1018 PLATFORM_FAILURE, false);
1019 return true; 1019 return true;
1020 } 1020 }
OLDNEW
« no previous file with comments | « content/common/gpu/media/omx_video_decode_accelerator.h ('k') | content/renderer/gpu/command_buffer_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698