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

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

Issue 11144036: Update Decryptor interface to support audio decoding. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: resolve comments Created 8 years, 2 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 #include "webkit/media/crypto/ppapi/clear_key_cdm.h" 5 #include "webkit/media/crypto/ppapi/clear_key_cdm.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 const cdm::InputBuffer& encrypted_buffer, 206 const cdm::InputBuffer& encrypted_buffer,
207 cdm::DecryptedBlock* decrypted_block) { 207 cdm::DecryptedBlock* decrypted_block) {
208 DVLOG(1) << "Decrypt()"; 208 DVLOG(1) << "Decrypt()";
209 209
210 scoped_refptr<media::DecoderBuffer> decoder_buffer = 210 scoped_refptr<media::DecoderBuffer> decoder_buffer =
211 CopyDecoderBufferFrom(encrypted_buffer); 211 CopyDecoderBufferFrom(encrypted_buffer);
212 212
213 // Callback is called synchronously, so we can use variables on the stack. 213 // Callback is called synchronously, so we can use variables on the stack.
214 media::Decryptor::Status status; 214 media::Decryptor::Status status;
215 scoped_refptr<media::DecoderBuffer> buffer; 215 scoped_refptr<media::DecoderBuffer> buffer;
216 decryptor_.Decrypt(decoder_buffer, 216 // We don't care what stream type it is here. So just pick video.
217 decryptor_.Decrypt(media::Decryptor::kVideo,
218 decoder_buffer,
217 base::Bind(&CopyDecryptResults, &status, &buffer)); 219 base::Bind(&CopyDecryptResults, &status, &buffer));
218 220
219 if (status == media::Decryptor::kError) 221 if (status == media::Decryptor::kError)
220 return cdm::kDecryptError; 222 return cdm::kDecryptError;
221 223
222 if (status == media::Decryptor::kNoKey) 224 if (status == media::Decryptor::kNoKey)
223 return cdm::kNoKey; 225 return cdm::kNoKey;
224 226
225 DCHECK(buffer); 227 DCHECK(buffer);
226 int data_size = buffer->GetDataSize(); 228 int data_size = buffer->GetDataSize();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 video_frame->set_format(cdm::kEmptyVideoFrame); 262 video_frame->set_format(cdm::kEmptyVideoFrame);
261 return cdm::kSuccess; 263 return cdm::kSuccess;
262 } 264 }
263 265
264 scoped_refptr<media::DecoderBuffer> decoder_buffer = 266 scoped_refptr<media::DecoderBuffer> decoder_buffer =
265 CopyDecoderBufferFrom(encrypted_buffer); 267 CopyDecoderBufferFrom(encrypted_buffer);
266 268
267 // Callback is called synchronously, so we can use variables on the stack. 269 // Callback is called synchronously, so we can use variables on the stack.
268 media::Decryptor::Status status; 270 media::Decryptor::Status status;
269 scoped_refptr<media::DecoderBuffer> buffer; 271 scoped_refptr<media::DecoderBuffer> buffer;
270 decryptor_.Decrypt(decoder_buffer, 272 decryptor_.Decrypt(media::Decryptor::kVideo,
273 decoder_buffer,
271 base::Bind(&CopyDecryptResults, &status, &buffer)); 274 base::Bind(&CopyDecryptResults, &status, &buffer));
272 275
273 if (status == media::Decryptor::kError) 276 if (status == media::Decryptor::kError)
274 return cdm::kDecryptError; 277 return cdm::kDecryptError;
275 278
276 if (status == media::Decryptor::kNoKey) 279 if (status == media::Decryptor::kNoKey)
277 return cdm::kNoKey; 280 return cdm::kNoKey;
278 281
279 #if !defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) 282 #if !defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER)
280 NOTIMPLEMENTED(); 283 NOTIMPLEMENTED();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 324
322 static unsigned char color = 0; 325 static unsigned char color = 0;
323 color += 10; 326 color += 10;
324 327
325 memset(reinterpret_cast<void*>(video_frame->frame_buffer()->data()), 328 memset(reinterpret_cast<void*>(video_frame->frame_buffer()->data()),
326 color, frame_size); 329 color, frame_size);
327 } 330 }
328 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER 331 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER
329 332
330 } // namespace webkit_media 333 } // namespace webkit_media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698