Index: media/mojo/services/mojo_video_decoder.h |
diff --git a/media/mojo/services/mojo_video_decoder.h b/media/mojo/services/mojo_video_decoder.h |
index cee3a0d86ffce501b269aa2df1399b3f2b6026da..fda324dfd6e87870d641005f8eda248a597aa2f3 100644 |
--- a/media/mojo/services/mojo_video_decoder.h |
+++ b/media/mojo/services/mojo_video_decoder.h |
@@ -8,6 +8,9 @@ |
#include "base/macros.h" |
#include "base/memory/ref_counted.h" |
#include "media/base/video_decoder.h" |
+#include "media/mojo/interfaces/video_decoder.mojom.h" |
+#include "mojo/public/cpp/bindings/binding.h" |
+#include "mojo/public/cpp/system/data_pipe.h" |
namespace base { |
class SingleThreadTaskRunner; |
@@ -16,9 +19,11 @@ class SingleThreadTaskRunner; |
namespace media { |
// A VideoDecoder that proxies to an interfaces::VideoDecoder. |
-class MojoVideoDecoder : public VideoDecoder { |
+class MojoVideoDecoder : public VideoDecoder, |
+ public interfaces::VideoDecoderClient { |
public: |
- MojoVideoDecoder(); |
+ MojoVideoDecoder(scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
+ interfaces::VideoDecoderPtr remote_decoder); |
~MojoVideoDecoder() final; |
// VideoDecoder implementation. |
@@ -35,9 +40,34 @@ class MojoVideoDecoder : public VideoDecoder { |
bool CanReadWithoutStalling() const final; |
int GetMaxDecodeRequests() const final; |
+ // interfaces::VideoDecoderClient implementation. |
+ void OnOutput(interfaces::VideoFramePtr frame) final; |
+ |
private: |
+ void OnInitialized(); |
+ void OnDecoded(interfaces::DecodeStatus status); |
+ void OnReset(); |
+ |
+ void OnConnectionError(); |
+ void BindRemoteDecoder(); |
+ |
scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
+ // Used to pass the remote decoder from the constructor (on the main thread) |
+ // to Initialize() (on the media thread). |
+ interfaces::VideoDecoderPtrInfo remote_decoder_info_; |
+ |
+ bool has_connection_error_ = false; |
+ InitCB init_cb_; |
+ OutputCB output_cb_; |
+ DecodeCB decode_cb_; |
+ base::Closure reset_cb_; |
+ |
+ interfaces::VideoDecoderPtr remote_decoder_; |
+ bool remote_decoder_bound_ = false; |
+ mojo::ScopedDataPipeProducerHandle decoder_buffer_producer_; |
+ mojo::Binding<VideoDecoderClient> binding_; |
+ |
DISALLOW_COPY_AND_ASSIGN(MojoVideoDecoder); |
}; |