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

Unified Diff: media/gpu/android_video_decode_accelerator.h

Issue 2011653002: Close bitstream buffer shared memory handles on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moved BitstreamRecord code higher in avda.cc Created 4 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 | « no previous file | media/gpu/android_video_decode_accelerator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/gpu/android_video_decode_accelerator.h
diff --git a/media/gpu/android_video_decode_accelerator.h b/media/gpu/android_video_decode_accelerator.h
index a9069f9b7da656c09650f9e19973695ce97f80c1..95a57bc0a6f898f877e7f200267f7d95bc3e0092 100644
--- a/media/gpu/android_video_decode_accelerator.h
+++ b/media/gpu/android_video_decode_accelerator.h
@@ -35,6 +35,8 @@ class SurfaceTexture;
namespace media {
+class SharedMemoryRegion;
+
// A VideoDecodeAccelerator implementation for Android.
// This class decodes the input encoded stream by using Android's MediaCodec
// class. http://developer.android.com/reference/android/media/MediaCodec.html
@@ -378,9 +380,23 @@ class MEDIA_GPU_EXPORT AndroidVideoDecodeAccelerator
// The resolution of the stream.
gfx::Size size_;
+ // Handy structure to remember a BitstreamBuffer and also its shared memory,
+ // if any. The goal is to prevent leaving a BitstreamBuffer's shared memory
+ // handle open.
+ struct BitstreamRecord {
+ BitstreamRecord(const media::BitstreamBuffer&);
+ BitstreamRecord(BitstreamRecord&& other);
+ ~BitstreamRecord();
+
+ media::BitstreamBuffer buffer;
+
+ // |memory| is not mapped, and may be null if buffer has no data.
+ std::unique_ptr<SharedMemoryRegion> memory;
+ };
+
// Encoded bitstream buffers to be passed to media codec, queued until an
// input buffer is available.
- std::queue<media::BitstreamBuffer> pending_bitstream_buffers_;
+ std::queue<BitstreamRecord> pending_bitstream_records_;
// A map of presentation timestamp to bitstream buffer id for the bitstream
// buffers that have been submitted to the decoder but haven't yet produced an
« no previous file with comments | « no previous file | media/gpu/android_video_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698