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

Unified Diff: content/common/gpu/media/vt_video_decode_accelerator.h

Issue 491163002: Implement flushing in VTVideoDecodeAccelerator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: New state machine. Created 6 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 side-by-side diff with in-line comments
Download patch
Index: content/common/gpu/media/vt_video_decode_accelerator.h
diff --git a/content/common/gpu/media/vt_video_decode_accelerator.h b/content/common/gpu/media/vt_video_decode_accelerator.h
index 185d0fb1b77b039553a79feed89f3d5495f1163e..a618405171da612ea3f457eb0268d36853757c77 100644
--- a/content/common/gpu/media/vt_video_decode_accelerator.h
+++ b/content/common/gpu/media/vt_video_decode_accelerator.h
@@ -64,16 +64,39 @@ class VTVideoDecodeAccelerator
base::ScopedCFTypeRef<CVImageBufferRef> image_buffer;
};
+ enum Action {
Pawel Osciak 2014/09/25 01:27:29 Please document this and the class.
sandersd (OOO until July 31) 2014/09/25 19:18:53 Done.
+ ACTION_FLUSH,
+ ACTION_RESET,
+ ACTION_DESTROY
+ };
+
+ struct PendingAction {
+ PendingAction(Action action, int32_t bitstream_id);
+ ~PendingAction();
+
+ Action action;
+ int32_t bitstream_id;
+ };
+
// Methods for interacting with VideoToolbox. Run on |decoder_thread_|.
void ConfigureDecoder(
const std::vector<const uint8_t*>& nalu_data_ptrs,
const std::vector<size_t>& nalu_data_sizes);
void DecodeTask(const media::BitstreamBuffer);
+ void FlushTask();
// Methods for interacting with |client_|. Run on |gpu_task_runner_|.
void OutputTask(DecodedFrame frame);
void SizeChangedTask(gfx::Size coded_size);
- void SendPictures();
+
+ // Send decoded frames up to and including |up_to_bitstream_id|, and return
+ // the last sent |bitstream_id|.
+ int32_t SendPictures(int32_t up_to_bitstream_id);
+
+ void ProcessDecodedFrames();
Pawel Osciak 2014/09/25 01:27:29 Please document.
sandersd (OOO until July 31) 2014/09/25 19:18:53 Done.
+ void CompleteAction(Action action);
+ void CompleteActions(int32_t bitstream_id);
+ void QueueAction(Action action);
//
// GPU thread state.
@@ -82,6 +105,14 @@ class VTVideoDecodeAccelerator
media::VideoDecodeAccelerator::Client* client_;
gfx::Size texture_size_;
+ // Since VideoToolbox has no reset feature (only flush), and the VDA API
+ // allows Decode() and Flush() calls during a reset operation, it's possible
+ // to have multiple pending actions at once. We handle the fully general
+ // case of an arbitrary sequence of pending actions (in reality, there should
+ // probably be at most one reset and one flush at a time).
+ std::queue<PendingAction> pending_actions_;
+ std::queue<int32_t> pending_bitstream_ids_;
+
// Texture IDs of pictures.
// TODO(sandersd): A single map of structs holding picture data.
std::map<int32_t, uint32_t> texture_ids_;
@@ -105,7 +136,7 @@ class VTVideoDecodeAccelerator
gfx::Size coded_size_;
//
- // Unprotected shared state (set up and torn down on GPU thread).
+ // Shared state (set up and torn down on GPU thread).
//
scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner_;

Powered by Google App Engine
This is Rietveld 408576698