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

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: Code review comments Created 6 years 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 c544cf67e4e4dabda5f4b9de532369f5262ed67c..134061ef7d1c368065d414d54d2d6ac87451b8f5 100644
--- a/content/common/gpu/media/dxva_video_decode_accelerator.h
+++ b/content/common/gpu/media/dxva_video_decode_accelerator.h
@@ -20,7 +20,9 @@
#include "base/compiler_specific.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/weak_ptr.h"
+#include "base/synchronization/lock.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 +70,7 @@ class CONTENT_EXPORT DXVAVideoDecodeAccelerator
private:
typedef void* EGLConfig;
typedef void* EGLSurface;
+
// 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 decoder.
@@ -158,6 +161,26 @@ 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. Called from the main thread and the decoder
+ // thread. The state is changed on the main thread.
+ void SetState(State state);
+
+ // Gets the state of the decoder. Can be called from the main thread and
+ // the decoder thread. Threadsafe.
DaleCurtis 2014/12/03 22:34:42 Thread safe?
+ 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();
+
+ // Starts the thread used for decoding.
+ void StartDecoderThread();
+
+ // Returns if we have output samples waiting to be processed. We only
+ // allow one output sample to be present in the output queue at any given
+ // time.
+ bool OutputSamplesPresent();
+
// To expose client callbacks from VideoDecodeAccelerator.
media::VideoDecodeAccelerator::Client* client_;
@@ -226,6 +249,21 @@ class CONTENT_EXPORT DXVAVideoDecodeAccelerator
// Which codec we are decoding with hardware acceleration.
media::VideoCodec codec_;
+ // 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::SingleThreadTaskRunner> decoder_thread_task_runner_;
+
+ // Task runner to be used for posting tasks to the main thread.
+ scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
+
+ // Used to synchronize access between the decoder thread and the main thread.
+ // Currently only used to synchronize access to the pending output samples
+ // queue.
+ base::Lock decoder_lock_;
};
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698