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

Side by Side Diff: media/video/omx_video_decode_engine.cc

Issue 3335014: Added FakeGlVideoDecodeEngine to exercise the IPC protocol for hardware video decoding (Closed)
Patch Set: compile man... Created 10 years, 3 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // This class interacts with OmxCodec and the VideoDecoderImpl 5 // This class interacts with OmxCodec and the VideoDecoderImpl
6 // in the media pipeline. 6 // in the media pipeline.
7 // 7 //
8 // THREADING SEMANTICS 8 // THREADING SEMANTICS
9 // 9 //
10 // This class is created by OmxVideoDecoder and lives on the thread 10 // This class is created by OmxVideoDecoder and lives on the thread
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 void OmxVideoDecodeEngine::Initialize( 82 void OmxVideoDecodeEngine::Initialize(
83 MessageLoop* message_loop, 83 MessageLoop* message_loop,
84 VideoDecodeEngine::EventHandler* event_handler, 84 VideoDecodeEngine::EventHandler* event_handler,
85 const VideoCodecConfig& config) { 85 const VideoCodecConfig& config) {
86 DCHECK_EQ(message_loop, MessageLoop::current()); 86 DCHECK_EQ(message_loop, MessageLoop::current());
87 87
88 message_loop_ = message_loop; 88 message_loop_ = message_loop;
89 event_handler_ = event_handler; 89 event_handler_ = event_handler;
90 90
91 width_ = config.width_; 91 width_ = config.width;
92 height_ = config.height_; 92 height_ = config.height;
93 93
94 // TODO(wjia): Find the right way to determine the codec type. 94 // TODO(wjia): Find the right way to determine the codec type.
95 OmxConfigurator::MediaFormat input_format, output_format; 95 OmxConfigurator::MediaFormat input_format, output_format;
96 memset(&input_format, 0, sizeof(input_format)); 96 memset(&input_format, 0, sizeof(input_format));
97 memset(&output_format, 0, sizeof(output_format)); 97 memset(&output_format, 0, sizeof(output_format));
98 input_format.codec = OmxConfigurator::kCodecH264; 98 input_format.codec = OmxConfigurator::kCodecH264;
99 output_format.codec = OmxConfigurator::kCodecRaw; 99 output_format.codec = OmxConfigurator::kCodecRaw;
100 configurator_.reset( 100 configurator_.reset(
101 new OmxDecoderConfigurator(input_format, output_format)); 101 new OmxDecoderConfigurator(input_format, output_format));
102 102
103 // TODO(jiesun): We already ensure Initialize() is called in thread context, 103 // TODO(jiesun): We already ensure Initialize() is called in thread context,
104 // We should try to merge the following function into this function. 104 // We should try to merge the following function into this function.
105 client_state_ = kClientInitializing; 105 client_state_ = kClientInitializing;
106 InitializeTask(); 106 InitializeTask();
107 107
108 VideoCodecInfo info; 108 VideoCodecInfo info;
109 // TODO(jiesun): ridiculous, we never fail initialization? 109 // TODO(jiesun): ridiculous, we never fail initialization?
110 info.success_ = true; 110 info.success = true;
111 info.provides_buffers_ = !uses_egl_image_; 111 info.provides_buffers = !uses_egl_image_;
112 info.stream_info_.surface_type_ = 112 info.stream_info.surface_type =
113 uses_egl_image_ ? VideoFrame::TYPE_GL_TEXTURE 113 uses_egl_image_ ? VideoFrame::TYPE_GL_TEXTURE
114 : VideoFrame::TYPE_SYSTEM_MEMORY; 114 : VideoFrame::TYPE_SYSTEM_MEMORY;
115 info.stream_info_.surface_format_ = GetSurfaceFormat(); 115 info.stream_info.surface_format = GetSurfaceFormat();
116 info.stream_info_.surface_width_ = config.width_; 116 info.stream_info.surface_width = config.width;
117 info.stream_info_.surface_height_ = config.height_; 117 info.stream_info.surface_height = config.height;
118 event_handler_->OnInitializeComplete(info); 118 event_handler_->OnInitializeComplete(info);
119 } 119 }
120 120
121 // This method handles only input buffer, without coupling with output 121 // This method handles only input buffer, without coupling with output
122 void OmxVideoDecodeEngine::ConsumeVideoSample(scoped_refptr<Buffer> buffer) { 122 void OmxVideoDecodeEngine::ConsumeVideoSample(scoped_refptr<Buffer> buffer) {
123 DCHECK_EQ(message_loop_, MessageLoop::current()); 123 DCHECK_EQ(message_loop_, MessageLoop::current());
124 DCHECK(!free_input_buffers_.empty()); 124 DCHECK(!free_input_buffers_.empty());
125 DCHECK_GT(input_pending_request_, 0); 125 DCHECK_GT(input_pending_request_, 0);
126 126
127 --input_pending_request_; 127 --input_pending_request_;
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 NewRunnableMethod(decoder, 1332 NewRunnableMethod(decoder,
1333 &OmxVideoDecodeEngine::FillBufferDoneTask, buffer)); 1333 &OmxVideoDecodeEngine::FillBufferDoneTask, buffer));
1334 return OMX_ErrorNone; 1334 return OMX_ErrorNone;
1335 } 1335 }
1336 1336
1337 } // namespace media 1337 } // namespace media
1338 1338
1339 // Disable refcounting for this object because this object only lives 1339 // Disable refcounting for this object because this object only lives
1340 // on the video decoder thread and there's no need to refcount it. 1340 // on the video decoder thread and there's no need to refcount it.
1341 DISABLE_RUNNABLE_METHOD_REFCOUNT(media::OmxVideoDecodeEngine); 1341 DISABLE_RUNNABLE_METHOD_REFCOUNT(media::OmxVideoDecodeEngine);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698