diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-10 03:21:47 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-10 03:21:47 +0000 |
commit | 3414eec11e4571ee0c85edc81750300e3809d5e1 (patch) | |
tree | 6b0f3e2ef0b8057a35e7c8f52981a5c4192f4ccd /media | |
parent | fb856c7c3b8ed71b0d15cbe08ef4ca35eb79abd3 (diff) | |
download | chromium_src-3414eec11e4571ee0c85edc81750300e3809d5e1.zip chromium_src-3414eec11e4571ee0c85edc81750300e3809d5e1.tar.gz chromium_src-3414eec11e4571ee0c85edc81750300e3809d5e1.tar.bz2 |
Fix using of OmxInputBuffer
OmxInputBuffer is now ref counted, but some code still try to
delete it explicitly. This delete call is hidden in a template
function so it was hard to find!
Review URL: http://codereview.chromium.org/601015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38571 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/filters/omx_video_decode_engine.cc | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/media/filters/omx_video_decode_engine.cc b/media/filters/omx_video_decode_engine.cc index 1297af1..9a22302 100644 --- a/media/filters/omx_video_decode_engine.cc +++ b/media/filters/omx_video_decode_engine.cc @@ -97,21 +97,18 @@ void OmxVideoDecodeEngine::DecodeFrame(const Buffer& buffer, } if (!has_fed_on_eos_) { - // TODO(ajwong): This is a memcpy() of the compressed frame. Avoid? - uint8* data = new uint8[buffer.GetDataSize()]; - memcpy(data, buffer.GetData(), buffer.GetDataSize()); - - OmxInputBuffer* input_buffer = - new OmxInputBuffer(data, buffer.GetDataSize()); - - // Feed in the new buffer regardless. - // - // TODO(ajwong): This callback stuff is messy. Cleanup. - CleanupCallback<OmxCodec::FeedCallback>* feed_done = - new CleanupCallback<OmxCodec::FeedCallback>( - NewCallback(this, &OmxVideoDecodeEngine::OnFeedDone)); - feed_done->DeleteWhenDone(input_buffer); - omx_codec_->Feed(input_buffer, feed_done); + OmxInputBuffer* input_buffer; + if (buffer.IsEndOfStream()) { + input_buffer = new OmxInputBuffer(NULL, 0); + } else { + // TODO(ajwong): This is a memcpy() of the compressed frame. Avoid? + uint8* data = new uint8[buffer.GetDataSize()]; + memcpy(data, buffer.GetData(), buffer.GetDataSize()); + input_buffer = new OmxInputBuffer(data, buffer.GetDataSize()); + } + + omx_codec_->Feed(input_buffer, + NewCallback(this, &OmxVideoDecodeEngine::OnFeedDone)); if (buffer.IsEndOfStream()) { has_fed_on_eos_ = true; |