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

Unified Diff: content/gpu/omx_video_decode_accelerator.cc

Issue 7034040: Updated video decoder IPC to use PPB_Buffer_Dev's new support for SharedMemory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR response. Created 9 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/gpu/omx_video_decode_accelerator.h ('k') | content/renderer/gpu_video_decode_accelerator_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/gpu/omx_video_decode_accelerator.cc
diff --git a/content/gpu/omx_video_decode_accelerator.cc b/content/gpu/omx_video_decode_accelerator.cc
index 2213c49a418a89b82b231eb3ae2c5cee55cb74c1..8a2561c900c45f10b0e00a660e61bd69b893b904 100644
--- a/content/gpu/omx_video_decode_accelerator.cc
+++ b/content/gpu/omx_video_decode_accelerator.cc
@@ -248,7 +248,7 @@ bool OmxVideoDecodeAccelerator::CreateComponent() {
}
bool OmxVideoDecodeAccelerator::Decode(
- media::BitstreamBuffer* bitstream_buffer,
+ const media::BitstreamBuffer& bitstream_buffer,
const media::VideoDecodeAcceleratorCallback& callback) {
DCHECK(!free_input_buffers_.empty());
DCHECK(bitstream_buffer);
@@ -260,9 +260,15 @@ bool OmxVideoDecodeAccelerator::Decode(
OMX_BUFFERHEADERTYPE* omx_buffer = free_input_buffers_.front();
free_input_buffers_.pop();
- // setup |omx_buffer|.
- omx_buffer->pBuffer = static_cast<OMX_U8*>(bitstream_buffer->bitstream());
- omx_buffer->nFilledLen = bitstream_buffer->bitstream_size();
+ // Setup |omx_buffer|.
+ scoped_ptr<base::SharedMemory> shm(
+ new base::SharedMemory(bitstream_buffer.handle(), true));
+ if (!shm->Map(bitstream_buffer.size())) {
+ LOG(ERROR) << "Failed to SharedMemory::Map().";
+ return false;
+ }
+ omx_buffer->pBuffer = static_cast<OMX_U8*>(shm->memory());
+ omx_buffer->nFilledLen = bitstream_buffer->size();
omx_buffer->nAllocLen = omx_buffer->nFilledLen;
omx_buffer->nFlags &= ~OMX_BUFFERFLAG_EOS;
@@ -279,7 +285,8 @@ bool OmxVideoDecodeAccelerator::Decode(
input_buffers_at_component_++;
// OMX_EmptyThisBuffer is a non blocking call and should
// not make any assumptions about its completion.
- omx_buff_cb_.insert(std::make_pair(omx_buffer, callback));
+ omx_buff_cb_.insert(std::make_pair(
+ omx_buffer, make_pair(shm.release(), callback)));
return true;
}
@@ -729,7 +736,8 @@ void OmxVideoDecodeAccelerator::EmptyBufferDoneTask(
StopOnError();
return;
}
- it->second.Run();
+ delete it->second.first;
+ it->second.second.Run();
omx_buff_cb_.erase(it);
}
@@ -877,4 +885,3 @@ void OmxVideoDecodeAccelerator::ChangePort(
}
DISABLE_RUNNABLE_METHOD_REFCOUNT(OmxVideoDecodeAccelerator);
-
« no previous file with comments | « content/gpu/omx_video_decode_accelerator.h ('k') | content/renderer/gpu_video_decode_accelerator_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698