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 cd56db2cc81d861e8e7cdb630df5b6719a4ffe10..03d59570d38e482d3b0d1e737960d61db68c4247 100644 |
--- a/content/common/gpu/media/vt_video_decode_accelerator.h |
+++ b/content/common/gpu/media/vt_video_decode_accelerator.h |
@@ -94,13 +94,24 @@ class VTVideoDecodeAccelerator |
// Methods for interacting with |client_|. Run on |gpu_task_runner_|. |
void OutputTask(DecodedFrame frame); |
- void SizeChangedTask(gfx::Size coded_size); |
void NotifyError(Error error); |
// 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); |
+ // Internal helper for SendPictures(): Drop frames with no image data up to |
+ // the next action, so that if there is still a frame in the queue it is |
+ // guaranteed to have image data, and thus it is time to set up the GPU |
+ // context. |
Pawel Osciak
2014/11/02 23:09:52
Parameters and return value are unclear.
sandersd (OOO until July 31)
2014/11/03 21:14:25
Done.
|
+ int32_t ProcessDroppedFrames( |
+ int32_t last_sent_bitstream_id, |
+ int32_t up_to_bitstream_id); |
+ |
+ // Internal helper for SendPictures(): Check if the next frame has a size |
+ // different from the current picture buffers, and request new ones if so. |
+ void ProcessSizeChange(); |
+ |
// 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 |
@@ -127,17 +138,32 @@ class VTVideoDecodeAccelerator |
CGLContextObj cgl_context_; |
base::Callback<bool(void)> make_context_current_; |
media::VideoDecodeAccelerator::Client* client_; |
- bool has_error_; // client_->NotifyError() called. |
- gfx::Size texture_size_; |
+ |
+ // client_->NotifyError() called. |
+ bool has_error_; |
+ |
+ // Size of assigned picture buffers. |
+ gfx::Size picture_size_; |
+ |
+ // Queue of actions so that we can quickly discover what the next action will |
+ // be; this is useful because we are dropping all frames when the next action |
+ // is ACTION_RESET or ACTION_DESTROY. |
std::queue<PendingAction> pending_actions_; |
+ |
+ // Queue of bitstreams currently being decoded. This is mostly needed to be |
Pawel Osciak
2014/11/02 23:09:52
Or waiting to be decoded...
sandersd (OOO until July 31)
2014/11/03 21:14:25
Done.
|
+ // sure we free them all in Destroy(). |
std::queue<int32_t> pending_bitstream_ids_; |
- // Texture IDs of pictures. |
- // TODO(sandersd): A single map of structs holding picture data. |
+ // All picture buffers assigned to us. Used to check if reused picture buffers |
+ // should be added back to the available list or released. (They are not |
+ // released immediately because we need the reuse event to free the binding.) |
+ std::set<int32_t> assigned_picture_ids_; |
+ |
+ // Texture IDs of assigned pictures. |
std::map<int32_t, uint32_t> texture_ids_; |
// Pictures ready to be rendered to. |
- std::queue<int32_t> available_picture_ids_; |
+ std::vector<int32_t> available_picture_ids_; |
// Decoded frames ready to render. |
std::queue<DecodedFrame> decoded_frames_; |
@@ -152,7 +178,10 @@ class VTVideoDecodeAccelerator |
base::ScopedCFTypeRef<CMFormatDescriptionRef> format_; |
base::ScopedCFTypeRef<VTDecompressionSessionRef> session_; |
media::H264Parser parser_; |
- gfx::Size coded_size_; |
+ |
+ std::vector<uint8_t> last_sps_; |
+ std::vector<uint8_t> last_spsext_; |
+ std::vector<uint8_t> last_pps_; |
// |
// Shared state (set up and torn down on GPU thread). |