| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 | 993 |
| 994 bool OmxVideoDecodeAccelerator::SendCommandToPort( | 994 bool OmxVideoDecodeAccelerator::SendCommandToPort( |
| 995 OMX_COMMANDTYPE cmd, int port_index) { | 995 OMX_COMMANDTYPE cmd, int port_index) { |
| 996 DCHECK_EQ(message_loop_, MessageLoop::current()); | 996 DCHECK_EQ(message_loop_, MessageLoop::current()); |
| 997 OMX_ERRORTYPE result = OMX_SendCommand(component_handle_, | 997 OMX_ERRORTYPE result = OMX_SendCommand(component_handle_, |
| 998 cmd, port_index, 0); | 998 cmd, port_index, 0); |
| 999 RETURN_ON_OMX_FAILURE(result, "SendCommand() failed" << cmd, | 999 RETURN_ON_OMX_FAILURE(result, "SendCommand() failed" << cmd, |
| 1000 PLATFORM_FAILURE, false); | 1000 PLATFORM_FAILURE, false); |
| 1001 return true; | 1001 return true; |
| 1002 } | 1002 } |
| OLD | NEW |