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

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

Issue 11778079: Encrypted Media: Enforcing the CDM to decode audio into S16 integers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
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/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/base/decryptor.h" 11 #include "media/base/decryptor.h"
12 #include "media/base/demuxer_stream.h" 12 #include "media/base/demuxer_stream.h"
13 13
14 namespace base { 14 namespace base {
15 class MessageLoopProxy; 15 class MessageLoopProxy;
16 } 16 }
17 17
18 namespace media { 18 namespace media {
19 19
20 class DecoderBuffer; 20 class DecoderBuffer;
21 class Decryptor; 21 class Decryptor;
22 22
23 // Decryptor-based AudioDecoder implementation that can decrypt and decode 23 // Decryptor-based AudioDecoder implementation that can decrypt and decode
24 // encrypted audio buffers and return decrypted and decompressed audio frames. 24 // encrypted audio buffers and return decrypted and decompressed audio frames.
25 // All public APIs and callbacks are trampolined to the |message_loop_| so 25 // All public APIs and callbacks are trampolined to the |message_loop_| so
26 // that no locks are required for thread safety. 26 // that no locks are required for thread safety.
27 class MEDIA_EXPORT DecryptingAudioDecoder : public AudioDecoder { 27 class MEDIA_EXPORT DecryptingAudioDecoder : public AudioDecoder {
28 public: 28 public:
29 // We do not currently have a way to let the Decrytptor choose the output
DaleCurtis 2013/01/10 01:24:35 s/Decrytptor/Decryptor/
xhwang 2013/01/10 18:17:23 Done.
30 // audio sample format and notify us its choice. Therefore, we require all
DaleCurtis 2013/01/10 01:24:35 s/its/of its/
xhwang 2013/01/10 18:17:23 Done.
31 // Decryptor implementations to decode audio into a fixed integer sample
32 // format with kSupportedBitsPerChannel.
DaleCurtis 2013/01/10 01:24:35 s/with/designated by/
xhwang 2013/01/10 18:17:23 Done.
33 // TODO(xhwang): Remove this restriction after http://crbug.com/169105 fixed.
34 static const int kSupportedBitsPerChannel;
35
29 DecryptingAudioDecoder( 36 DecryptingAudioDecoder(
30 const scoped_refptr<base::MessageLoopProxy>& message_loop, 37 const scoped_refptr<base::MessageLoopProxy>& message_loop,
31 const SetDecryptorReadyCB& set_decryptor_ready_cb); 38 const SetDecryptorReadyCB& set_decryptor_ready_cb);
32 39
33 // AudioDecoder implementation. 40 // AudioDecoder implementation.
34 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, 41 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream,
35 const PipelineStatusCB& status_cb, 42 const PipelineStatusCB& status_cb,
36 const StatisticsCB& statistics_cb) OVERRIDE; 43 const StatisticsCB& statistics_cb) OVERRIDE;
37 virtual void Read(const ReadCB& read_cb) OVERRIDE; 44 virtual void Read(const ReadCB& read_cb) OVERRIDE;
38 virtual void Reset(const base::Closure& closure) OVERRIDE; 45 virtual void Reset(const base::Closure& closure) OVERRIDE;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 Decryptor::Status status, 102 Decryptor::Status status,
96 const Decryptor::AudioBuffers& frames); 103 const Decryptor::AudioBuffers& frames);
97 104
98 // Callback for the |decryptor_| to notify this object that a new key has been 105 // Callback for the |decryptor_| to notify this object that a new key has been
99 // added. 106 // added.
100 void OnKeyAdded(); 107 void OnKeyAdded();
101 108
102 // Resets decoder and calls |reset_cb_|. 109 // Resets decoder and calls |reset_cb_|.
103 void DoReset(); 110 void DoReset();
104 111
112 // Sets audio configs from |demuxer_stream_| and resets
113 // |output_timestamp_base_| and |total_samples_decoded_|.
114 void SetDecoderConfig();
115
105 // Sets timestamp and duration for |queued_audio_frames_| to make sure the 116 // Sets timestamp and duration for |queued_audio_frames_| to make sure the
106 // renderer always receives continuous frames without gaps and overlaps. 117 // renderer always receives continuous frames without gaps and overlaps.
107 void EnqueueFrames(const Decryptor::AudioBuffers& frames); 118 void EnqueueFrames(const Decryptor::AudioBuffers& frames);
108 119
109 // Converts number of samples to duration. 120 // Converts number of samples to duration.
110 base::TimeDelta NumberOfSamplesToDuration(int number_of_samples) const; 121 base::TimeDelta NumberOfSamplesToDuration(int number_of_samples) const;
111 122
112 scoped_refptr<base::MessageLoopProxy> message_loop_; 123 scoped_refptr<base::MessageLoopProxy> message_loop_;
113 124
114 State state_; 125 State state_;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 158
148 base::TimeDelta output_timestamp_base_; 159 base::TimeDelta output_timestamp_base_;
149 int total_samples_decoded_; 160 int total_samples_decoded_;
150 161
151 DISALLOW_COPY_AND_ASSIGN(DecryptingAudioDecoder); 162 DISALLOW_COPY_AND_ASSIGN(DecryptingAudioDecoder);
152 }; 163 };
153 164
154 } // namespace media 165 } // namespace media
155 166
156 #endif // MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_ 167 #endif // MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_
OLDNEW
« no previous file with comments | « no previous file | media/filters/decrypting_audio_decoder.cc » ('j') | media/filters/decrypting_audio_decoder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698