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

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

Issue 727893002: Implement a reorder queue in VTVideoDecodeAccelerator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@vt_queue_frames
Patch Set: Created 6 years, 1 month 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 5beffb2313abba1c7de1f0b4abc394c19bd208e4..226d37d823857a13c16dc836c2dffd6677fc93e2 100644
--- a/content/common/gpu/media/vt_video_decode_accelerator.h
+++ b/content/common/gpu/media/vt_video_decode_accelerator.h
@@ -16,6 +16,7 @@
#include "base/message_loop/message_loop.h"
#include "base/threading/thread.h"
#include "base/threading/thread_checker.h"
+#include "content/common/gpu/media/h264_dpb.h"
#include "content/common/gpu/media/vt.h"
#include "media/filters/h264_parser.h"
#include "media/video/video_decode_accelerator.h"
@@ -73,9 +74,11 @@ class VTVideoDecodeAccelerator : public media::VideoDecodeAccelerator {
~Frame();
int32_t bitstream_id;
- base::ScopedCFTypeRef<CVImageBufferRef> image;
+ // TODO(sandersd): Reorder window size.
+ int32_t pic_order_cnt;
DaleCurtis 2014/11/14 21:11:45 Needs docs. It'd be nice for all of them too.
sandersd (OOO until July 31) 2014/11/14 21:28:52 Done.
// TODO(sandersd): visible_rect.
gfx::Size coded_size;
+ base::ScopedCFTypeRef<CVImageBufferRef> image;
};
struct Task {
@@ -89,6 +92,7 @@ class VTVideoDecodeAccelerator : public media::VideoDecodeAccelerator {
//
// Methods for interacting with VideoToolbox. Run on |decoder_thread_|.
//
+
// Set up VideoToolbox using the current SPS and PPS. Returns true or calls
// NotifyError() before returning false.
bool ConfigureDecoder();
@@ -112,12 +116,14 @@ class VTVideoDecodeAccelerator : public media::VideoDecodeAccelerator {
void FlushTask(TaskType type);
void FlushDone(TaskType type);
- // Attempt to make progress on |pending_tasks_|.
- void ProcessTasks();
+ // Try to make progress on tasks in the |task_queue_| or sending frame in the
+ // |reorder_queue_|.
+ void ProcessWorkQueues();
// These methods returns true if the task was completed, false if it couldn't
// be completed yet.
- bool ProcessTask(const Task& task);
+ bool ProcessTaskQueue();
+ bool ProcessReorderQueue();
bool ProcessFrame(const Frame& frame);
bool SendFrame(const Frame& frame);
@@ -134,7 +140,19 @@ class VTVideoDecodeAccelerator : public media::VideoDecodeAccelerator {
std::queue<TaskType> pending_flush_tasks_;
// Queue of tasks to complete in the GPU thread.
- std::queue<Task> pending_tasks_;
+ std::queue<Task> task_queue_;
+
+ // Utility class to define the order of frames in the reorder queue.
+ struct FrameOrder {
+ bool operator()(
+ const linked_ptr<Frame>& lhs,
+ const linked_ptr<Frame>& rhs) const;
+ };
+
+ // Queue of decoded frames in presentation order.
+ std::priority_queue<linked_ptr<Frame>,
+ std::vector<linked_ptr<Frame>>,
+ FrameOrder> reorder_queue_;
// Size of assigned picture buffers.
gfx::Size picture_size_;
@@ -169,8 +187,10 @@ class VTVideoDecodeAccelerator : public media::VideoDecodeAccelerator {
media::H264Parser parser_;
gfx::Size coded_size_;
+ int last_sps_id_;
std::vector<uint8_t> last_sps_;
std::vector<uint8_t> last_spsext_;
+ int last_pps_id_;
std::vector<uint8_t> last_pps_;
//

Powered by Google App Engine
This is Rietveld 408576698