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

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

Issue 2568463003: media: Rename MediaKeys to ContentDecryptionModule (Closed)
Patch Set: comments addressed Created 4 years 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
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "media/base/audio_decoder.h" 14 #include "media/base/audio_decoder.h"
15 #include "media/mojo/interfaces/audio_decoder.mojom.h" 15 #include "media/mojo/interfaces/audio_decoder.mojom.h"
16 #include "media/mojo/services/media_mojo_export.h" 16 #include "media/mojo/services/media_mojo_export.h"
17 17
18 namespace media { 18 namespace media {
19 19
20 class MediaKeys; 20 class ContentDecryptionModule;
21 class MojoCdmServiceContext; 21 class MojoCdmServiceContext;
22 class MojoDecoderBufferReader; 22 class MojoDecoderBufferReader;
23 23
24 class MEDIA_MOJO_EXPORT MojoAudioDecoderService 24 class MEDIA_MOJO_EXPORT MojoAudioDecoderService
25 : NON_EXPORTED_BASE(public mojom::AudioDecoder) { 25 : NON_EXPORTED_BASE(public mojom::AudioDecoder) {
26 public: 26 public:
27 MojoAudioDecoderService( 27 MojoAudioDecoderService(
28 base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context, 28 base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context,
29 std::unique_ptr<media::AudioDecoder> decoder); 29 std::unique_ptr<media::AudioDecoder> decoder);
30 30
31 ~MojoAudioDecoderService() final; 31 ~MojoAudioDecoderService() final;
32 32
33 // mojom::AudioDecoder implementation 33 // mojom::AudioDecoder implementation
34 void Initialize(mojom::AudioDecoderClientAssociatedPtrInfo client, 34 void Initialize(mojom::AudioDecoderClientAssociatedPtrInfo client,
35 mojom::AudioDecoderConfigPtr config, 35 mojom::AudioDecoderConfigPtr config,
36 int32_t cdm_id, 36 int32_t cdm_id,
37 const InitializeCallback& callback) final; 37 const InitializeCallback& callback) final;
38 38
39 void SetDataSource(mojo::ScopedDataPipeConsumerHandle receive_pipe) final; 39 void SetDataSource(mojo::ScopedDataPipeConsumerHandle receive_pipe) final;
40 40
41 void Decode(mojom::DecoderBufferPtr buffer, 41 void Decode(mojom::DecoderBufferPtr buffer,
42 const DecodeCallback& callback) final; 42 const DecodeCallback& callback) final;
43 43
44 void Reset(const ResetCallback& callback) final; 44 void Reset(const ResetCallback& callback) final;
45 45
46 private: 46 private:
47 // Called by |decoder_| upon finishing initialization. 47 // Called by |decoder_| upon finishing initialization.
48 void OnInitialized(const InitializeCallback& callback, 48 void OnInitialized(const InitializeCallback& callback,
49 scoped_refptr<MediaKeys> cdm, 49 scoped_refptr<ContentDecryptionModule> cdm,
50 bool success); 50 bool success);
51 51
52 void OnReadDone(const DecodeCallback& callback, 52 void OnReadDone(const DecodeCallback& callback,
53 scoped_refptr<DecoderBuffer> buffer); 53 scoped_refptr<DecoderBuffer> buffer);
54 54
55 // Called by |decoder_| when DecoderBuffer is accepted or rejected. 55 // Called by |decoder_| when DecoderBuffer is accepted or rejected.
56 void OnDecodeStatus(const DecodeCallback& callback, 56 void OnDecodeStatus(const DecodeCallback& callback,
57 media::DecodeStatus status); 57 media::DecodeStatus status);
58 58
59 // Called by |decoder_| when reset sequence is finished. 59 // Called by |decoder_| when reset sequence is finished.
60 void OnResetDone(const ResetCallback& callback); 60 void OnResetDone(const ResetCallback& callback);
61 61
62 // Called by |decoder_| for each decoded buffer. 62 // Called by |decoder_| for each decoded buffer.
63 void OnAudioBufferReady(const scoped_refptr<AudioBuffer>& audio_buffer); 63 void OnAudioBufferReady(const scoped_refptr<AudioBuffer>& audio_buffer);
64 64
65 std::unique_ptr<MojoDecoderBufferReader> mojo_decoder_buffer_reader_; 65 std::unique_ptr<MojoDecoderBufferReader> mojo_decoder_buffer_reader_;
66 66
67 // A helper object required to get CDM from CDM id. 67 // A helper object required to get CDM from CDM id.
68 base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context_; 68 base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context_;
69 69
70 // The destination for the decoded buffers. 70 // The destination for the decoded buffers.
71 mojom::AudioDecoderClientAssociatedPtr client_; 71 mojom::AudioDecoderClientAssociatedPtr client_;
72 72
73 // Hold a reference to the CDM to keep it alive for the lifetime of the 73 // Hold a reference to the CDM to keep it alive for the lifetime of the
74 // |decoder_|. The |cdm_| owns the CdmContext which is passed to |decoder_|. 74 // |decoder_|. The |cdm_| owns the CdmContext which is passed to |decoder_|.
75 scoped_refptr<MediaKeys> cdm_; 75 scoped_refptr<ContentDecryptionModule> cdm_;
76 76
77 // The AudioDecoder that does actual decoding work. 77 // The AudioDecoder that does actual decoding work.
78 // This MUST be declared after |cdm_| to maintain correct destruction order. 78 // This MUST be declared after |cdm_| to maintain correct destruction order.
79 // The |decoder_| may need to access the CDM to do some clean up work in its 79 // The |decoder_| may need to access the CDM to do some clean up work in its
80 // own destructor. 80 // own destructor.
81 std::unique_ptr<media::AudioDecoder> decoder_; 81 std::unique_ptr<media::AudioDecoder> decoder_;
82 82
83 base::WeakPtr<MojoAudioDecoderService> weak_this_; 83 base::WeakPtr<MojoAudioDecoderService> weak_this_;
84 base::WeakPtrFactory<MojoAudioDecoderService> weak_factory_; 84 base::WeakPtrFactory<MojoAudioDecoderService> weak_factory_;
85 85
86 DISALLOW_COPY_AND_ASSIGN(MojoAudioDecoderService); 86 DISALLOW_COPY_AND_ASSIGN(MojoAudioDecoderService);
87 }; 87 };
88 88
89 } // namespace media 89 } // namespace media
90 90
91 #endif // MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_SERVICE_H_ 91 #endif // MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_SERVICE_H_
OLDNEW
« no previous file with comments | « media/mojo/interfaces/content_decryption_module.typemap ('k') | media/mojo/services/mojo_audio_decoder_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698