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

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: Fixed presubmit 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..939d6953120b01c15d02db3b3edfdd893a4430a0 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_;
DaleCurtis 2014/12/03 01:04:33 This should be declared below and the typedef with
+
// 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.
@@ -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.
DaleCurtis 2014/12/03 01:04:33 "thread-safe" or "thread safe" -- up to you.
ananta 2014/12/03 04:08:02 Reworded
+ 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,10 +231,6 @@ 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_;
@@ -226,6 +239,16 @@ 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::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