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

Side by Side Diff: webkit/media/crypto/ppapi/clear_key_cdm.h

Issue 11242005: Fake clear key CDM audio decoder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 1 month 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
« no previous file with comments | « no previous file | webkit/media/crypto/ppapi/clear_key_cdm.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 WEBKIT_MEDIA_CRYPTO_PPAPI_CLEAR_KEY_CDM_H_ 5 #ifndef WEBKIT_MEDIA_CRYPTO_PPAPI_CLEAR_KEY_CDM_H_
6 #define WEBKIT_MEDIA_CRYPTO_PPAPI_CLEAR_KEY_CDM_H_ 6 #define WEBKIT_MEDIA_CRYPTO_PPAPI_CLEAR_KEY_CDM_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/synchronization/lock.h" 14 #include "base/synchronization/lock.h"
15 #include "media/base/decryptor_client.h" 15 #include "media/base/decryptor_client.h"
16 #include "media/crypto/aes_decryptor.h" 16 #include "media/crypto/aes_decryptor.h"
17 #include "webkit/media/crypto/ppapi/content_decryption_module.h" 17 #include "webkit/media/crypto/ppapi/content_decryption_module.h"
18 18
19 // Enable this to use the fake decoder for testing. 19 // Enable this to use the fake decoder for testing.
20 // #define CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER 20 #if 0
21 #define CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER
22 #endif
23
24 #if 0
25 #define CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER
26 #endif
21 27
22 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) 28 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER)
23 #undef CLEAR_KEY_CDM_USE_FFMPEG_DECODER 29 #undef CLEAR_KEY_CDM_USE_FFMPEG_DECODER
24 #endif 30 #endif
25 31
26 namespace media { 32 namespace media {
27 class DecoderBuffer; 33 class DecoderBuffer;
28 } 34 }
29 35
30 namespace webkit_media { 36 namespace webkit_media {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // put in |decrypted_buffer|. If |encrypted_buffer| is empty, the 124 // put in |decrypted_buffer|. If |encrypted_buffer| is empty, the
119 // |decrypted_buffer| is set to an empty (EOS) buffer. 125 // |decrypted_buffer| is set to an empty (EOS) buffer.
120 // Returns cdm::kNoKey if no decryption key was available. In this case 126 // Returns cdm::kNoKey if no decryption key was available. In this case
121 // |decrypted_buffer| should be ignored by the caller. 127 // |decrypted_buffer| should be ignored by the caller.
122 // Returns cdm::kDecryptError if any decryption error occurred. In this case 128 // Returns cdm::kDecryptError if any decryption error occurred. In this case
123 // |decrypted_buffer| should be ignored by the caller. 129 // |decrypted_buffer| should be ignored by the caller.
124 cdm::Status DecryptToMediaDecoderBuffer( 130 cdm::Status DecryptToMediaDecoderBuffer(
125 const cdm::InputBuffer& encrypted_buffer, 131 const cdm::InputBuffer& encrypted_buffer,
126 scoped_refptr<media::DecoderBuffer>* decrypted_buffer); 132 scoped_refptr<media::DecoderBuffer>* decrypted_buffer);
127 133
134 #if defined(CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER)
135 // Generates fake video frames with |last_timestamp_| and |last_duration_|.
136 void GenerateFakeAudioFrames(cdm::AudioFrames* audio_frames);
137 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER
138
128 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) 139 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER)
140 // Generate a fake video frame with |video_size_| and |timestamp|.
129 void GenerateFakeVideoFrame(base::TimeDelta timestamp, 141 void GenerateFakeVideoFrame(base::TimeDelta timestamp,
130 cdm::VideoFrame* video_frame); 142 cdm::VideoFrame* video_frame);
131 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER 143 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER
132 144
133 Client client_; 145 Client client_;
134 media::AesDecryptor decryptor_; 146 media::AesDecryptor decryptor_;
135 147
136 // Protects the |client_| from being accessed by the |decryptor_| 148 // Protects the |client_| from being accessed by the |decryptor_|
137 // simultaneously. 149 // simultaneously.
138 base::Lock client_lock_; 150 base::Lock client_lock_;
139 151
140 cdm::Allocator* const allocator_; 152 cdm::Allocator* const allocator_;
141 153
154 #if defined(CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER)
155 int channel_count_;
156 int bits_per_channel_;
157 int samples_per_second_;
158 base::TimeDelta last_timestamp_;
159 base::TimeDelta last_duration_;
160 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER
161
142 #if defined(CLEAR_KEY_CDM_USE_FFMPEG_DECODER) 162 #if defined(CLEAR_KEY_CDM_USE_FFMPEG_DECODER)
143 scoped_ptr<FFmpegCdmVideoDecoder> video_decoder_; 163 scoped_ptr<FFmpegCdmVideoDecoder> video_decoder_;
144 #endif 164 #endif // CLEAR_KEY_CDM_USE_FFMPEG_DECODER
145 165
146 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) 166 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER)
147 cdm::Size video_size_; 167 cdm::Size video_size_;
148 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER 168 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER
149 }; 169 };
150 170
151 } // namespace webkit_media 171 } // namespace webkit_media
152 172
153 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CLEAR_KEY_CDM_H_ 173 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CLEAR_KEY_CDM_H_
OLDNEW
« no previous file with comments | « no previous file | webkit/media/crypto/ppapi/clear_key_cdm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698