summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorjiesun@google.com <jiesun@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-07 23:44:59 +0000
committerjiesun@google.com <jiesun@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-07 23:44:59 +0000
commit94b2c5e86633303b7feb5492f66ef512a66492ac (patch)
tree8c70132d7202557996a17313ab4cceffe8bfddd1 /media
parent263e3de5c303436eb55eefd2d4acc89332d00f42 (diff)
downloadchromium_src-94b2c5e86633303b7feb5492f66ef512a66492ac.zip
chromium_src-94b2c5e86633303b7feb5492f66ef512a66492ac.tar.gz
chromium_src-94b2c5e86633303b7feb5492f66ef512a66492ac.tar.bz2
refactor on-goning.
TEST= both mode on partner board. BUG=none Review URL: http://codereview.chromium.org/2727001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49122 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/filters/omx_video_decode_engine.cc46
-rw-r--r--media/filters/omx_video_decode_engine.h7
2 files changed, 8 insertions, 45 deletions
diff --git a/media/filters/omx_video_decode_engine.cc b/media/filters/omx_video_decode_engine.cc
index 13ee05e..68b1ac4 100644
--- a/media/filters/omx_video_decode_engine.cc
+++ b/media/filters/omx_video_decode_engine.cc
@@ -967,28 +967,19 @@ void OmxVideoDecodeEngine::EmptyBufferTask() {
void OmxVideoDecodeEngine::FulfillOneRead() {
DCHECK_EQ(message_loop_, MessageLoop::current());
- if (!uses_egl_image_ && !output_buffers_ready_.empty()) {
- int buffer_id = output_buffers_ready_.front();
- output_buffers_ready_.pop();
-
- // If the buffer is real then send it to downstream.
- // Otherwise if it is an end-of-stream buffer then just drop it.
- if (buffer_id != kEosBuffer) {
- FinishFillBuffer(output_buffers_[buffer_id]);
- SendOutputBufferToComponent(output_buffers_[buffer_id]);
- } else {
- FinishFillBuffer(static_cast<OMX_BUFFERHEADERTYPE*>(NULL));
- }
- } else if (uses_egl_image_ && !output_frames_ready_.empty()) {
+ if (!output_frames_ready_.empty()) {
OMX_BUFFERHEADERTYPE *buffer = output_frames_ready_.front();
output_frames_ready_.pop();
// If the buffer is real then send it to downstream.
// Otherwise if it is an end-of-stream buffer then just drop it.
if (buffer->nFlags & OMX_BUFFERFLAG_EOS) {
+ // We intentionally drop last frame because it could be garbage.
FinishFillBuffer(static_cast<OMX_BUFFERHEADERTYPE*>(NULL));
} else {
FinishFillBuffer(buffer);
+ // In non-EGLImage path, OMX_BUFFERHEADERTYPEs are immediately recycled.
+ if (!uses_egl_image_) SendOutputBufferToComponent(buffer);
}
}
}
@@ -1122,32 +1113,11 @@ void OmxVideoDecodeEngine::FillBufferDoneTask(OMX_BUFFERHEADERTYPE* buffer) {
// This buffer is received with decoded frame. Enqueue it and make it
// ready to be consumed by reads.
- if (uses_egl_image_) {
- if (buffer->nFlags & OMX_BUFFERFLAG_EOS) {
- output_eos_ = true;
- DLOG(INFO) << "Output has EOS";
- }
- output_frames_ready_.push(buffer);
- } else {
- int buffer_id = kEosBuffer;
- for (size_t i = 0; output_buffers_.size(); ++i) {
- if (output_buffers_[i] == buffer) {
- buffer_id = i;
- break;
- }
- }
-
- DCHECK_NE(buffer_id, kEosBuffer);
-
- // Determine if the buffer received is a end-of-stream buffer. If
- // the condition is true then assign a EOS id to the buffer.
- if (buffer->nFlags & OMX_BUFFERFLAG_EOS || !buffer->nFilledLen) {
- buffer_id = kEosBuffer;
- output_eos_ = true;
- DLOG(INFO) << "Output has EOS";
- }
- output_buffers_ready_.push(buffer_id);
+ if (buffer->nFlags & OMX_BUFFERFLAG_EOS) {
+ output_eos_ = true;
+ DLOG(INFO) << "Output has EOS";
}
+ output_frames_ready_.push(buffer);
// Try to fulfill one read request.
FulfillOneRead();
diff --git a/media/filters/omx_video_decode_engine.h b/media/filters/omx_video_decode_engine.h
index c535125..9c3d386 100644
--- a/media/filters/omx_video_decode_engine.h
+++ b/media/filters/omx_video_decode_engine.h
@@ -236,13 +236,6 @@ class OmxVideoDecodeEngine :
// OMX_EmptyThisBuffer() call.
std::queue<OMX_BUFFERHEADERTYPE*> available_input_buffers_;
- // A queue of buffers that carries decoded video frames. They are
- // ready to return to client.
- // TOOD(hclam): extract it to a separate class.
- // TODO(wjia): merge output_buffers with output_frames. Use
- // OMX_BUFFERHEADERTYPE* directly.
- std::queue<int> output_buffers_ready_;
-
// For output buffer recycling cases.
typedef std::pair<scoped_refptr<VideoFrame>,
OMX_BUFFERHEADERTYPE*> OutputFrame;