Index: media/mojo/services/mojo_audio_decoder.h |
diff --git a/media/mojo/services/mojo_audio_decoder.h b/media/mojo/services/mojo_audio_decoder.h |
index eba5e75cdbd9ea3b27aabb202383031166ead818..6bfae6e8415d14fba205b4e91d8dc920bf49177b 100644 |
--- a/media/mojo/services/mojo_audio_decoder.h |
+++ b/media/mojo/services/mojo_audio_decoder.h |
@@ -9,6 +9,7 @@ |
#include "base/memory/ref_counted.h" |
#include "media/base/audio_decoder.h" |
#include "media/mojo/interfaces/audio_decoder.mojom.h" |
+#include "mojo/public/cpp/bindings/binding.h" |
namespace base { |
class SingleThreadTaskRunner; |
@@ -17,7 +18,8 @@ class SingleThreadTaskRunner; |
namespace media { |
// An AudioDecoder that proxies to an interfaces::AudioDecoder. |
-class MojoAudioDecoder : public AudioDecoder { |
+class MojoAudioDecoder : public AudioDecoder, |
+ public interfaces::AudioDecoderClient { |
public: |
MojoAudioDecoder(scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
interfaces::AudioDecoderPtr remote_decoder); |
@@ -34,10 +36,41 @@ class MojoAudioDecoder : public AudioDecoder { |
void Reset(const base::Closure& closure) final; |
bool NeedsBitstreamConversion() const final; |
+ // AudioDecoderClient implementation. |
+ void OnBufferDecoded(interfaces::AudioBufferPtr buffer) final; |
+ |
private: |
+ // Callback for connection error on |remote_decoder_|. |
+ void OnConnectionError(); |
+ |
+ // Called when |remote_decoder_| finished initialization. |
+ void OnInitialized(bool status, bool needs_bitstream_conversion); |
+ |
+ // Called when |remote_decoder_| accepted or rejected DecoderBuffer. |
+ void OnDecodeStatus(interfaces::AudioDecoder::DecodeStatus decode_status); |
+ |
+ // called when |remote_decoder_| finished Reset() sequence. |
+ void OnResetDone(); |
+ |
scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
+ |
interfaces::AudioDecoderPtr remote_decoder_; |
+ // Binding for AudioDecoderClient, bound to the |task_runner_|. |
+ mojo::Binding<AudioDecoderClient> binding_; |
+ |
+ // We call these callbacks to pass the information to the pipeline. |
+ InitCB init_cb_; |
+ DecodeCB decode_cb_; |
+ base::Closure reset_cb_; |
+ |
+ // Flag that is set if we got connection error. Never cleared. |
+ bool has_connection_error_; |
+ |
+ // Flag telling whether this decoder requires bitstream conversion. |
+ // Passed from |remote_decoder_| as a result of its initialization. |
+ bool needs_bitstream_conversion_; |
+ |
DISALLOW_COPY_AND_ASSIGN(MojoAudioDecoder); |
}; |