Index: media/video/video_encode_accelerator.h |
diff --git a/media/video/video_encode_accelerator.h b/media/video/video_encode_accelerator.h |
index ac1ffd56dfa8a1f51a54c5e7d7284a7584c174fc..2d10da73982f025f1f218a055fb2c4cb622e9c64 100644 |
--- a/media/video/video_encode_accelerator.h |
+++ b/media/video/video_encode_accelerator.h |
@@ -12,6 +12,8 @@ |
#include <vector> |
#include "base/memory/ref_counted.h" |
+#include "base/memory/weak_ptr.h" |
+#include "base/single_thread_task_runner.h" |
#include "media/base/bitstream_buffer.h" |
#include "media/base/media_export.h" |
#include "media/base/video_decoder_config.h" |
@@ -147,11 +149,29 @@ class MEDIA_EXPORT VideoEncodeAccelerator { |
// Destroys the encoder: all pending inputs and outputs are dropped |
// immediately and the component is freed. This call may asynchronously free |
- // system resources, but its client-visible effects are synchronous. After |
- // this method returns no more callbacks will be made on the client. Deletes |
+ // system resources, but its client-visible effects are synchronous. After |
+ // this method returns no more callbacks will be made on the client. Deletes |
// |this| unconditionally, so make sure to drop all pointers to it! |
virtual void Destroy() = 0; |
+ // Encode tasks include these methods that are used frequently during the |
+ // session: Encode(), UseOutputBitstreamBuffer(), |
+ // RequestEncodingParametersChange(), Client::BitstreamBufferReady(). |
+ // If the Client can support running these on a separate thread, it may |
+ // call this method to try to set up the VEA implementation to do so. |
+ // |
+ // If the VEA can support this as well, return true, otherwise return false. |
+ // If true is returned, the client may submit each of these calls on |
+ // |encode_task_runner|, and then expect Client::BitstreamBufferReady() to be |
+ // called on |encode_task_runner| as well; called on |encode_client|, instead |
+ // of |client| provided to Initialize(). |
+ // |
+ // One application of this is offloading the GPU main thread. This helps |
+ // reduce latency and jitter by avoiding the wait. |
+ virtual bool TryToSetupEncodeOnSeparateThread( |
+ const base::WeakPtr<Client>& encode_client, |
+ const scoped_refptr<base::SingleThreadTaskRunner>& encode_task_runner); |
+ |
protected: |
// Do not delete directly; use Destroy() or own it with a scoped_ptr, which |
// will Destroy() it properly by default. |