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

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

Issue 12212079: Update Cdm Wrapper and ClearKeyCdm to work with CDM interface version 4. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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 | 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/ffmpeg_cdm_audio_decoder.h" 5 #include "webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "media/base/audio_bus.h" 10 #include "media/base/audio_bus.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 memcpy(codec_context->extradata, config.extra_data, 73 memcpy(codec_context->extradata, config.extra_data,
74 config.extra_data_size); 74 config.extra_data_size);
75 memset(codec_context->extradata + config.extra_data_size, '\0', 75 memset(codec_context->extradata + config.extra_data_size, '\0',
76 FF_INPUT_BUFFER_PADDING_SIZE); 76 FF_INPUT_BUFFER_PADDING_SIZE);
77 } else { 77 } else {
78 codec_context->extradata = NULL; 78 codec_context->extradata = NULL;
79 codec_context->extradata_size = 0; 79 codec_context->extradata_size = 0;
80 } 80 }
81 } 81 }
82 82
83 FFmpegCdmAudioDecoder::FFmpegCdmAudioDecoder(cdm::Allocator* allocator) 83 FFmpegCdmAudioDecoder::FFmpegCdmAudioDecoder(cdm::Host* host)
84 : is_initialized_(false), 84 : is_initialized_(false),
85 allocator_(allocator), 85 host_(host),
86 codec_context_(NULL), 86 codec_context_(NULL),
87 av_frame_(NULL), 87 av_frame_(NULL),
88 bits_per_channel_(0), 88 bits_per_channel_(0),
89 samples_per_second_(0), 89 samples_per_second_(0),
90 bytes_per_frame_(0), 90 bytes_per_frame_(0),
91 last_input_timestamp_(media::kNoTimestamp()), 91 last_input_timestamp_(media::kNoTimestamp()),
92 output_bytes_to_drop_(0) { 92 output_bytes_to_drop_(0) {
93 } 93 }
94 94
95 FFmpegCdmAudioDecoder::~FFmpegCdmAudioDecoder() { 95 FFmpegCdmAudioDecoder::~FFmpegCdmAudioDecoder() {
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 SerializeInt64(output->GetDataSize()); 344 SerializeInt64(output->GetDataSize());
345 serialized_audio_frames_.insert( 345 serialized_audio_frames_.insert(
346 serialized_audio_frames_.end(), 346 serialized_audio_frames_.end(),
347 output->GetData(), 347 output->GetData(),
348 output->GetData() + output->GetDataSize()); 348 output->GetData() + output->GetDataSize());
349 } 349 }
350 } while (packet.size > 0); 350 } while (packet.size > 0);
351 351
352 if (!serialized_audio_frames_.empty()) { 352 if (!serialized_audio_frames_.empty()) {
353 decoded_frames->SetFrameBuffer( 353 decoded_frames->SetFrameBuffer(
354 allocator_->Allocate(serialized_audio_frames_.size())); 354 host_->Allocate(serialized_audio_frames_.size()));
355 if (!decoded_frames->FrameBuffer()) { 355 if (!decoded_frames->FrameBuffer()) {
356 LOG(ERROR) << "DecodeBuffer() cdm::Allocator::Allocate failed."; 356 LOG(ERROR) << "DecodeBuffer() cdm::Host::Allocate failed.";
357 return cdm::kDecodeError; 357 return cdm::kDecodeError;
358 } 358 }
359 memcpy(decoded_frames->FrameBuffer()->Data(), 359 memcpy(decoded_frames->FrameBuffer()->Data(),
360 &serialized_audio_frames_[0], 360 &serialized_audio_frames_[0],
361 serialized_audio_frames_.size()); 361 serialized_audio_frames_.size());
362 decoded_frames->FrameBuffer()->SetSize(serialized_audio_frames_.size()); 362 decoded_frames->FrameBuffer()->SetSize(serialized_audio_frames_.size());
363 serialized_audio_frames_.clear(); 363 serialized_audio_frames_.clear();
364 364
365 return cdm::kSuccess; 365 return cdm::kSuccess;
366 } 366 }
(...skipping 22 matching lines...) Expand all
389 } 389 }
390 } 390 }
391 391
392 void FFmpegCdmAudioDecoder::SerializeInt64(int64 value) { 392 void FFmpegCdmAudioDecoder::SerializeInt64(int64 value) {
393 int previous_size = serialized_audio_frames_.size(); 393 int previous_size = serialized_audio_frames_.size();
394 serialized_audio_frames_.resize(previous_size + sizeof(value)); 394 serialized_audio_frames_.resize(previous_size + sizeof(value));
395 memcpy(&serialized_audio_frames_[0] + previous_size, &value, sizeof(value)); 395 memcpy(&serialized_audio_frames_[0] + previous_size, &value, sizeof(value));
396 } 396 }
397 397
398 } // namespace webkit_media 398 } // namespace webkit_media
OLDNEW
« no previous file with comments | « webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.h ('k') | webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698