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

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

Issue 765533005: Move the DXVA decoder off the GPU thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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/dxva_video_decode_accelerator.h
diff --git a/content/common/gpu/media/dxva_video_decode_accelerator.h b/content/common/gpu/media/dxva_video_decode_accelerator.h
index 10933573f0bcf076c98681d794a05f7d0425b02f..40bd63fde1cc9800af3d7483a116ceb09abe8563 100644
--- a/content/common/gpu/media/dxva_video_decode_accelerator.h
+++ b/content/common/gpu/media/dxva_video_decode_accelerator.h
@@ -21,6 +21,7 @@
#include "base/memory/linked_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/non_thread_safe.h"
+#include "base/threading/thread.h"
#include "base/win/scoped_comptr.h"
#include "content/common/content_export.h"
#include "media/video/video_decode_accelerator.h"
@@ -68,6 +69,10 @@ class CONTENT_EXPORT DXVAVideoDecodeAccelerator
private:
typedef void* EGLConfig;
typedef void* EGLSurface;
+ // List of input samples waiting to be processed.
+ typedef std::list<base::win::ScopedComPtr<IMFSample>> PendingInputs;
+ PendingInputs pending_input_buffers_;
+
// Creates and initializes an instance of the D3D device and the
// corresponding device manager. The device manager instance is eventually
// passed to the IMFTransform interface implemented by the h.264 decoder.
@@ -135,7 +140,7 @@ class CONTENT_EXPORT DXVAVideoDecodeAccelerator
// Sends pending input buffer processed acks to the client if we don't have
// output samples waiting to be processed.
- void NotifyInputBuffersDropped();
+ void NotifyInputBuffersDropped(const PendingInputs& input_buffers);
// Decodes pending input buffers.
void DecodePendingInputBuffers();
@@ -158,6 +163,18 @@ class CONTENT_EXPORT DXVAVideoDecodeAccelerator
// Called after the client indicates we can recycle a stale picture buffer.
void DeferredDismissStaleBuffer(int32 picture_buffer_id);
+ // Sets the state of the decoder. Can be called from the main thread and
+ // the decoder thread. Threadsafe.
+ void SetState(State state);
+
+ // Gets the state of the decoder. Can be called from the main thread and
+ // the decoder thread. Threadsafe.
+ State GetState() const;
+
+ // Worker function for the Decoder Reset functionality. Executes on the
+ // decoder thread and queues tasks on the main thread as needed.
+ void ResetHelper();
+
// To expose client callbacks from VideoDecodeAccelerator.
media::VideoDecodeAccelerator::Client* client_;
@@ -214,15 +231,22 @@ class CONTENT_EXPORT DXVAVideoDecodeAccelerator
// decode.
int inputs_before_decode_;
- // List of input samples waiting to be processed.
- typedef std::list<base::win::ScopedComPtr<IMFSample>> PendingInputs;
- PendingInputs pending_input_buffers_;
-
// Callback to set the correct gl context.
base::Callback<bool(void)> make_context_current_;
// WeakPtrFactory for posting tasks back to |this|.
base::WeakPtrFactory<DXVAVideoDecodeAccelerator> weak_this_factory_;
+
+ // Thread on which the decoder operations like passing input frames,
+ // getting output frames are performed. One instance of this thread
+ // is created per decoder instance.
+ base::Thread decoder_thread_;
+
+ // Task runner to be used for posting tasks to the decoder thread.
+ scoped_refptr<base::TaskRunner> decoder_thread_task_runner_;
+
+ // Task runner to be used for posting tasks to the main thread.
+ scoped_refptr<base::TaskRunner> main_thread_task_runner_;
};
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698