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

Unified Diff: media/mojo/services/mojo_audio_decoder.h

Issue 1815553002: Implement MojoAudioDecoder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@spitzer-audio-client-connect
Patch Set: Added DCHECK for no pending decode_cb on reset and a comment Created 4 years, 9 months 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
« no previous file with comments | « no previous file | media/mojo/services/mojo_audio_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« no previous file with comments | « no previous file | media/mojo/services/mojo_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698