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

Side by Side Diff: media/mojo/services/mojo_audio_decoder.h

Issue 1977173002: Rename media::interfaces to media::mojom. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: android + chromeos files Created 4 years, 7 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 | « media/mojo/services/media_mojo_unittest.cc ('k') | 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 #include "mojo/public/cpp/bindings/binding.h"
13 #include "mojo/public/cpp/system/data_pipe.h" 13 #include "mojo/public/cpp/system/data_pipe.h"
14 14
15 namespace base { 15 namespace base {
16 class SingleThreadTaskRunner; 16 class SingleThreadTaskRunner;
17 } 17 }
18 18
19 namespace media { 19 namespace media {
20 20
21 // An AudioDecoder that proxies to an interfaces::AudioDecoder. 21 // An AudioDecoder that proxies to a mojom::AudioDecoder.
22 class MojoAudioDecoder : public AudioDecoder, 22 class MojoAudioDecoder : public AudioDecoder, public mojom::AudioDecoderClient {
23 public interfaces::AudioDecoderClient {
24 public: 23 public:
25 MojoAudioDecoder(scoped_refptr<base::SingleThreadTaskRunner> task_runner, 24 MojoAudioDecoder(scoped_refptr<base::SingleThreadTaskRunner> task_runner,
26 interfaces::AudioDecoderPtr remote_decoder); 25 mojom::AudioDecoderPtr remote_decoder);
27 ~MojoAudioDecoder() final; 26 ~MojoAudioDecoder() final;
28 27
29 // AudioDecoder implementation. 28 // AudioDecoder implementation.
30 std::string GetDisplayName() const final; 29 std::string GetDisplayName() const final;
31 void Initialize(const AudioDecoderConfig& config, 30 void Initialize(const AudioDecoderConfig& config,
32 CdmContext* cdm_context, 31 CdmContext* cdm_context,
33 const InitCB& init_cb, 32 const InitCB& init_cb,
34 const OutputCB& output_cb) final; 33 const OutputCB& output_cb) final;
35 void Decode(const scoped_refptr<DecoderBuffer>& buffer, 34 void Decode(const scoped_refptr<DecoderBuffer>& buffer,
36 const DecodeCB& decode_cb) final; 35 const DecodeCB& decode_cb) final;
37 void Reset(const base::Closure& closure) final; 36 void Reset(const base::Closure& closure) final;
38 bool NeedsBitstreamConversion() const final; 37 bool NeedsBitstreamConversion() const final;
39 38
40 // AudioDecoderClient implementation. 39 // AudioDecoderClient implementation.
41 void OnBufferDecoded(interfaces::AudioBufferPtr buffer) final; 40 void OnBufferDecoded(mojom::AudioBufferPtr buffer) final;
42 41
43 private: 42 private:
44 // Callback for connection error on |remote_decoder_|. 43 // Callback for connection error on |remote_decoder_|.
45 void OnConnectionError(); 44 void OnConnectionError();
46 45
47 // Called when |remote_decoder_| finished initialization. 46 // Called when |remote_decoder_| finished initialization.
48 void OnInitialized(bool success, bool needs_bitstream_conversion); 47 void OnInitialized(bool success, bool needs_bitstream_conversion);
49 48
50 // Called when |remote_decoder_| accepted or rejected DecoderBuffer. 49 // Called when |remote_decoder_| accepted or rejected DecoderBuffer.
51 void OnDecodeStatus(interfaces::AudioDecoder::DecodeStatus decode_status); 50 void OnDecodeStatus(mojom::AudioDecoder::DecodeStatus decode_status);
52 51
53 // called when |remote_decoder_| finished Reset() sequence. 52 // called when |remote_decoder_| finished Reset() sequence.
54 void OnResetDone(); 53 void OnResetDone();
55 54
56 // A helper method that creates data pipe and sets the data connection to 55 // A helper method that creates data pipe and sets the data connection to
57 // the service. 56 // the service.
58 void CreateDataPipe(); 57 void CreateDataPipe();
59 58
60 // A helper method to serialize the data section of DecoderBuffer into pipe. 59 // A helper method to serialize the data section of DecoderBuffer into pipe.
61 interfaces::DecoderBufferPtr TransferDecoderBuffer( 60 mojom::DecoderBufferPtr TransferDecoderBuffer(
62 const scoped_refptr<DecoderBuffer>& media_buffer); 61 const scoped_refptr<DecoderBuffer>& media_buffer);
63 62
64 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 63 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
65 64
66 // This class is constructed on one thread and used exclusively on another 65 // This class is constructed on one thread and used exclusively on another
67 // thread. This member is used to safely pass the AudioDecoderPtr from one 66 // thread. This member is used to safely pass the AudioDecoderPtr from one
68 // thread to another. It is set in the constructor and is consumed in 67 // thread to another. It is set in the constructor and is consumed in
69 // Initialize(). 68 // Initialize().
70 interfaces::AudioDecoderPtrInfo remote_decoder_info_; 69 mojom::AudioDecoderPtrInfo remote_decoder_info_;
71 70
72 interfaces::AudioDecoderPtr remote_decoder_; 71 mojom::AudioDecoderPtr remote_decoder_;
73 72
74 // DataPipe for serializing the data section of DecoderBuffer. 73 // DataPipe for serializing the data section of DecoderBuffer.
75 mojo::ScopedDataPipeProducerHandle producer_handle_; 74 mojo::ScopedDataPipeProducerHandle producer_handle_;
76 75
77 // Binding for AudioDecoderClient, bound to the |task_runner_|. 76 // Binding for AudioDecoderClient, bound to the |task_runner_|.
78 mojo::Binding<AudioDecoderClient> binding_; 77 mojo::Binding<AudioDecoderClient> binding_;
79 78
80 // We call the following callbacks to pass the information to the pipeline. 79 // We call the following callbacks to pass the information to the pipeline.
81 // |output_cb_| is permanent while other three are called only once, 80 // |output_cb_| is permanent while other three are called only once,
82 // |decode_cb_| and |reset_cb_| are replaced by every by Decode() and Reset(). 81 // |decode_cb_| and |reset_cb_| are replaced by every by Decode() and Reset().
83 InitCB init_cb_; 82 InitCB init_cb_;
84 OutputCB output_cb_; 83 OutputCB output_cb_;
85 DecodeCB decode_cb_; 84 DecodeCB decode_cb_;
86 base::Closure reset_cb_; 85 base::Closure reset_cb_;
87 86
88 // Flag that is set if we got connection error. Never cleared. 87 // Flag that is set if we got connection error. Never cleared.
89 bool has_connection_error_; 88 bool has_connection_error_;
90 89
91 // Flag telling whether this decoder requires bitstream conversion. 90 // Flag telling whether this decoder requires bitstream conversion.
92 // Passed from |remote_decoder_| as a result of its initialization. 91 // Passed from |remote_decoder_| as a result of its initialization.
93 bool needs_bitstream_conversion_; 92 bool needs_bitstream_conversion_;
94 93
95 DISALLOW_COPY_AND_ASSIGN(MojoAudioDecoder); 94 DISALLOW_COPY_AND_ASSIGN(MojoAudioDecoder);
96 }; 95 };
97 96
98 } // namespace media 97 } // namespace media
99 98
100 #endif // MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_H_ 99 #endif // MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_H_
OLDNEW
« no previous file with comments | « media/mojo/services/media_mojo_unittest.cc ('k') | media/mojo/services/mojo_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698