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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | media/mojo/services/mojo_audio_decoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_H_ 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_H_
6 #define MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_H_ 6 #define MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "media/base/audio_decoder.h" 10 #include "media/base/audio_decoder.h"
11 #include "media/mojo/interfaces/audio_decoder.mojom.h" 11 #include "media/mojo/interfaces/audio_decoder.mojom.h"
12 #include "mojo/public/cpp/bindings/binding.h"
12 13
13 namespace base { 14 namespace base {
14 class SingleThreadTaskRunner; 15 class SingleThreadTaskRunner;
15 } 16 }
16 17
17 namespace media { 18 namespace media {
18 19
19 // An AudioDecoder that proxies to an interfaces::AudioDecoder. 20 // An AudioDecoder that proxies to an interfaces::AudioDecoder.
20 class MojoAudioDecoder : public AudioDecoder { 21 class MojoAudioDecoder : public AudioDecoder,
22 public interfaces::AudioDecoderClient {
21 public: 23 public:
22 MojoAudioDecoder(scoped_refptr<base::SingleThreadTaskRunner> task_runner, 24 MojoAudioDecoder(scoped_refptr<base::SingleThreadTaskRunner> task_runner,
23 interfaces::AudioDecoderPtr remote_decoder); 25 interfaces::AudioDecoderPtr remote_decoder);
24 ~MojoAudioDecoder() final; 26 ~MojoAudioDecoder() final;
25 27
26 // AudioDecoder implementation. 28 // AudioDecoder implementation.
27 std::string GetDisplayName() const final; 29 std::string GetDisplayName() const final;
28 void Initialize(const AudioDecoderConfig& config, 30 void Initialize(const AudioDecoderConfig& config,
29 CdmContext* cdm_context, 31 CdmContext* cdm_context,
30 const InitCB& init_cb, 32 const InitCB& init_cb,
31 const OutputCB& output_cb) final; 33 const OutputCB& output_cb) final;
32 void Decode(const scoped_refptr<DecoderBuffer>& buffer, 34 void Decode(const scoped_refptr<DecoderBuffer>& buffer,
33 const DecodeCB& decode_cb) final; 35 const DecodeCB& decode_cb) final;
34 void Reset(const base::Closure& closure) final; 36 void Reset(const base::Closure& closure) final;
35 bool NeedsBitstreamConversion() const final; 37 bool NeedsBitstreamConversion() const final;
36 38
39 // AudioDecoderClient implementation.
40 void OnBufferDecoded(interfaces::AudioBufferPtr buffer) final;
41
37 private: 42 private:
43 // Callback for connection error on |remote_decoder_|.
44 void OnConnectionError();
45
46 // Called when |remote_decoder_| finished initialization.
47 void OnInitialized(bool status, bool needs_bitstream_conversion);
48
49 // Called when |remote_decoder_| accepted or rejected DecoderBuffer.
50 void OnDecodeStatus(interfaces::AudioDecoder::DecodeStatus decode_status);
51
52 // called when |remote_decoder_| finished Reset() sequence.
53 void OnResetDone();
54
38 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 55 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
56
39 interfaces::AudioDecoderPtr remote_decoder_; 57 interfaces::AudioDecoderPtr remote_decoder_;
40 58
59 // Binding for AudioDecoderClient, bound to the |task_runner_|.
60 mojo::Binding<AudioDecoderClient> binding_;
61
62 // We call these callbacks to pass the information to the pipeline.
63 InitCB init_cb_;
64 DecodeCB decode_cb_;
65 base::Closure reset_cb_;
66
67 // Flag that is set if we got connection error. Never cleared.
68 bool has_connection_error_;
69
70 // Flag telling whether this decoder requires bitstream conversion.
71 // Passed from |remote_decoder_| as a result of its initialization.
72 bool needs_bitstream_conversion_;
73
41 DISALLOW_COPY_AND_ASSIGN(MojoAudioDecoder); 74 DISALLOW_COPY_AND_ASSIGN(MojoAudioDecoder);
42 }; 75 };
43 76
44 } // namespace media 77 } // namespace media
45 78
46 #endif // MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_H_ 79 #endif // MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_H_
OLDNEW
« 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