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

Side by Side Diff: media/filters/decrypting_audio_decoder.h

Issue 1666653002: media: Remove SetCdmReadyCB and CdmReadyCB (part 1). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and fix compile errors Created 4 years, 10 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/filters/decoder_stream_traits.cc ('k') | media/filters/decrypting_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_FILTERS_DECRYPTING_AUDIO_DECODER_H_ 5 #ifndef MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_
6 #define MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_ 6 #define MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 24 matching lines...) Expand all
35 public: 35 public:
36 DecryptingAudioDecoder( 36 DecryptingAudioDecoder(
37 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 37 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
38 const scoped_refptr<MediaLog>& media_log, 38 const scoped_refptr<MediaLog>& media_log,
39 const base::Closure& waiting_for_decryption_key_cb); 39 const base::Closure& waiting_for_decryption_key_cb);
40 ~DecryptingAudioDecoder() override; 40 ~DecryptingAudioDecoder() override;
41 41
42 // AudioDecoder implementation. 42 // AudioDecoder implementation.
43 std::string GetDisplayName() const override; 43 std::string GetDisplayName() const override;
44 void Initialize(const AudioDecoderConfig& config, 44 void Initialize(const AudioDecoderConfig& config,
45 const SetCdmReadyCB& set_cdm_ready_cb, 45 CdmContext* cdm_context,
46 const InitCB& init_cb, 46 const InitCB& init_cb,
47 const OutputCB& output_cb) override; 47 const OutputCB& output_cb) override;
48 void Decode(const scoped_refptr<DecoderBuffer>& buffer, 48 void Decode(const scoped_refptr<DecoderBuffer>& buffer,
49 const DecodeCB& decode_cb) override; 49 const DecodeCB& decode_cb) override;
50 void Reset(const base::Closure& closure) override; 50 void Reset(const base::Closure& closure) override;
51 51
52 private: 52 private:
53 // For a detailed state diagram please see this link: http://goo.gl/8jAok 53 // For a detailed state diagram please see this link: http://goo.gl/8jAok
54 // TODO(xhwang): Add a ASCII state diagram in this file after this class 54 // TODO(xhwang): Add a ASCII state diagram in this file after this class
55 // stabilizes. 55 // stabilizes.
56 // TODO(xhwang): Update this diagram for DecryptingAudioDecoder. 56 // TODO(xhwang): Update this diagram for DecryptingAudioDecoder.
57 enum State { 57 enum State {
58 kUninitialized = 0, 58 kUninitialized = 0,
59 kDecryptorRequested,
60 kPendingDecoderInit, 59 kPendingDecoderInit,
61 kIdle, 60 kIdle,
62 kPendingDecode, 61 kPendingDecode,
63 kWaitingForKey, 62 kWaitingForKey,
64 kDecodeFinished, 63 kDecodeFinished,
65 kError 64 kError
66 }; 65 };
67 66
68 // Callback to set CDM. |cdm_attached_cb| is called when the decryptor in the
69 // CDM has been completely attached to the pipeline.
70 void SetCdm(CdmContext* cdm_context, const CdmAttachedCB& cdm_attached_cb);
71
72 // Initializes the audio decoder on the |decryptor_| with |config_|. 67 // Initializes the audio decoder on the |decryptor_| with |config_|.
73 void InitializeDecoder(); 68 void InitializeDecoder();
74 69
75 // Callback for Decryptor::InitializeAudioDecoder() during initialization. 70 // Callback for Decryptor::InitializeAudioDecoder() during initialization.
76 void FinishInitialization(bool success); 71 void FinishInitialization(bool success);
77 72
78 void DecodePendingBuffer(); 73 void DecodePendingBuffer();
79 74
80 // Callback for Decryptor::DecryptAndDecodeAudio(). 75 // Callback for Decryptor::DecryptAndDecodeAudio().
81 void DeliverFrame(int buffer_size, 76 void DeliverFrame(int buffer_size,
(...skipping 18 matching lines...) Expand all
100 95
101 InitCB init_cb_; 96 InitCB init_cb_;
102 OutputCB output_cb_; 97 OutputCB output_cb_;
103 DecodeCB decode_cb_; 98 DecodeCB decode_cb_;
104 base::Closure reset_cb_; 99 base::Closure reset_cb_;
105 base::Closure waiting_for_decryption_key_cb_; 100 base::Closure waiting_for_decryption_key_cb_;
106 101
107 // The current decoder configuration. 102 // The current decoder configuration.
108 AudioDecoderConfig config_; 103 AudioDecoderConfig config_;
109 104
110 // Callback to request/cancel CDM ready notification.
111 SetCdmReadyCB set_cdm_ready_cb_;
112
113 Decryptor* decryptor_; 105 Decryptor* decryptor_;
114 106
115 // The buffer that needs decrypting/decoding. 107 // The buffer that needs decrypting/decoding.
116 scoped_refptr<media::DecoderBuffer> pending_buffer_to_decode_; 108 scoped_refptr<media::DecoderBuffer> pending_buffer_to_decode_;
117 109
118 // Indicates the situation where new key is added during pending decode 110 // Indicates the situation where new key is added during pending decode
119 // (in other words, this variable can only be set in state kPendingDecode). 111 // (in other words, this variable can only be set in state kPendingDecode).
120 // If this variable is true and kNoKey is returned then we need to try 112 // If this variable is true and kNoKey is returned then we need to try
121 // decrypting/decoding again in case the newly added key is the correct 113 // decrypting/decoding again in case the newly added key is the correct
122 // decryption key. 114 // decryption key.
123 bool key_added_while_decode_pending_; 115 bool key_added_while_decode_pending_;
124 116
125 scoped_ptr<AudioTimestampHelper> timestamp_helper_; 117 scoped_ptr<AudioTimestampHelper> timestamp_helper_;
126 118
127 base::WeakPtr<DecryptingAudioDecoder> weak_this_; 119 base::WeakPtr<DecryptingAudioDecoder> weak_this_;
128 base::WeakPtrFactory<DecryptingAudioDecoder> weak_factory_; 120 base::WeakPtrFactory<DecryptingAudioDecoder> weak_factory_;
129 121
130 DISALLOW_COPY_AND_ASSIGN(DecryptingAudioDecoder); 122 DISALLOW_COPY_AND_ASSIGN(DecryptingAudioDecoder);
131 }; 123 };
132 124
133 } // namespace media 125 } // namespace media
134 126
135 #endif // MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_ 127 #endif // MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_
OLDNEW
« no previous file with comments | « media/filters/decoder_stream_traits.cc ('k') | media/filters/decrypting_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698