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_; |