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

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

Issue 1810293005: Implement MojoAudioDecoderService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@spitzer-audio-client-init
Patch Set: Added log for NOTREACHED() 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_service.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_SERVICE_H_ 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_SERVICE_H_
6 #define MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_SERVICE_H_ 6 #define MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_SERVICE_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
10 #include "media/base/audio_decoder.h" 11 #include "media/base/audio_decoder.h"
11 #include "media/mojo/interfaces/audio_decoder.mojom.h" 12 #include "media/mojo/interfaces/audio_decoder.mojom.h"
12 #include "mojo/public/cpp/bindings/strong_binding.h" 13 #include "mojo/public/cpp/bindings/strong_binding.h"
13 14
14 namespace media { 15 namespace media {
15 16
16 class MojoAudioDecoderService : public interfaces::AudioDecoder { 17 class MojoAudioDecoderService : public interfaces::AudioDecoder {
17 public: 18 public:
18 MojoAudioDecoderService( 19 MojoAudioDecoderService(
19 scoped_ptr<media::AudioDecoder> decoder, 20 scoped_ptr<media::AudioDecoder> decoder,
20 mojo::InterfaceRequest<interfaces::AudioDecoder> request); 21 mojo::InterfaceRequest<interfaces::AudioDecoder> request);
21 22
22 ~MojoAudioDecoderService() final; 23 ~MojoAudioDecoderService() final;
23 24
24 // interfaces::AudioDecoder implementation 25 // interfaces::AudioDecoder implementation
25 void Initialize(interfaces::AudioDecoderClientPtr client, 26 void Initialize(interfaces::AudioDecoderClientPtr client,
26 interfaces::AudioDecoderConfigPtr config, 27 interfaces::AudioDecoderConfigPtr config,
27 int32_t cdm_id, 28 int32_t cdm_id,
28 const InitializeCallback& callback) final; 29 const InitializeCallback& callback) final;
29 30
30 void Decode(interfaces::DecoderBufferPtr buffer, 31 void Decode(interfaces::DecoderBufferPtr buffer,
31 const DecodeCallback& callback) final; 32 const DecodeCallback& callback) final;
32 33
33 void Reset(const ResetCallback& callback) final; 34 void Reset(const ResetCallback& callback) final;
34 35
35 private: 36 private:
37 // Called by |decoder_| upon finishing initialization.
38 void OnInitialized(const InitializeCallback& callback, bool success);
39
40 // Called by |decoder_| when DecoderBuffer is accepted or rejected.
41 void OnDecodeStatus(const DecodeCallback& callback,
42 media::AudioDecoder::Status status);
43
44 // Called by |decoder_| when reset sequence is finished.
45 void OnResetDone(const ResetCallback& callback);
46
47 // Called by |decoder_| for each decoded buffer.
48 void OnAudioBufferReady(const scoped_refptr<AudioBuffer>& audio_buffer);
49
50 // A helper method to read and deserialize DecoderBuffer from data pipe.
51 scoped_refptr<DecoderBuffer> ReadDecoderBuffer(
52 interfaces::DecoderBufferPtr buffer);
53
36 // A binding represents the association between the service and the 54 // A binding represents the association between the service and the
37 // communication channel, i.e. the pipe. 55 // communication channel, i.e. the pipe.
38 mojo::StrongBinding<interfaces::AudioDecoder> binding_; 56 mojo::StrongBinding<interfaces::AudioDecoder> binding_;
39 57
40 // The AudioDecoder that does actual decoding work. 58 // The AudioDecoder that does actual decoding work.
41 scoped_ptr<media::AudioDecoder> decoder_; 59 scoped_ptr<media::AudioDecoder> decoder_;
42 60
43 // The destination for the decoded buffers. 61 // The destination for the decoded buffers.
44 interfaces::AudioDecoderClientPtr client_; 62 interfaces::AudioDecoderClientPtr client_;
45 63
64 base::WeakPtr<MojoAudioDecoderService> weak_this_;
65 base::WeakPtrFactory<MojoAudioDecoderService> weak_factory_;
66
46 DISALLOW_COPY_AND_ASSIGN(MojoAudioDecoderService); 67 DISALLOW_COPY_AND_ASSIGN(MojoAudioDecoderService);
47 }; 68 };
48 69
49 } // namespace media 70 } // namespace media
50 71
51 #endif // MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_SERVICE_H_ 72 #endif // MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | media/mojo/services/mojo_audio_decoder_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698