| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "media/cdm/ppapi/ffmpeg_cdm_audio_decoder.h" | 5 #include "media/cdm/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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 173 } |
| 174 | 174 |
| 175 // Ensure avcodec_open2() respected our format request. | 175 // Ensure avcodec_open2() respected our format request. |
| 176 if (codec_context_->sample_fmt == AV_SAMPLE_FMT_S16P) { | 176 if (codec_context_->sample_fmt == AV_SAMPLE_FMT_S16P) { |
| 177 DLOG(ERROR) << "Unable to configure a supported sample format: " | 177 DLOG(ERROR) << "Unable to configure a supported sample format: " |
| 178 << codec_context_->sample_fmt; | 178 << codec_context_->sample_fmt; |
| 179 return false; | 179 return false; |
| 180 } | 180 } |
| 181 | 181 |
| 182 // Success! | 182 // Success! |
| 183 av_frame_.reset(avcodec_alloc_frame()); | 183 av_frame_.reset(av_frame_alloc()); |
| 184 samples_per_second_ = config.samples_per_second; | 184 samples_per_second_ = config.samples_per_second; |
| 185 bytes_per_frame_ = codec_context_->channels * config.bits_per_channel / 8; | 185 bytes_per_frame_ = codec_context_->channels * config.bits_per_channel / 8; |
| 186 output_timestamp_helper_.reset( | 186 output_timestamp_helper_.reset( |
| 187 new AudioTimestampHelper(config.samples_per_second)); | 187 new AudioTimestampHelper(config.samples_per_second)); |
| 188 is_initialized_ = true; | 188 is_initialized_ = true; |
| 189 | 189 |
| 190 // Store initial values to guard against midstream configuration changes. | 190 // Store initial values to guard against midstream configuration changes. |
| 191 channels_ = codec_context_->channels; | 191 channels_ = codec_context_->channels; |
| 192 av_sample_format_ = codec_context_->sample_fmt; | 192 av_sample_format_ = codec_context_->sample_fmt; |
| 193 | 193 |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 av_frame_.reset(); | 420 av_frame_.reset(); |
| 421 } | 421 } |
| 422 | 422 |
| 423 void FFmpegCdmAudioDecoder::SerializeInt64(int64 value) { | 423 void FFmpegCdmAudioDecoder::SerializeInt64(int64 value) { |
| 424 const size_t previous_size = serialized_audio_frames_.size(); | 424 const size_t previous_size = serialized_audio_frames_.size(); |
| 425 serialized_audio_frames_.resize(previous_size + sizeof(value)); | 425 serialized_audio_frames_.resize(previous_size + sizeof(value)); |
| 426 memcpy(&serialized_audio_frames_[0] + previous_size, &value, sizeof(value)); | 426 memcpy(&serialized_audio_frames_[0] + previous_size, &value, sizeof(value)); |
| 427 } | 427 } |
| 428 | 428 |
| 429 } // namespace media | 429 } // namespace media |
| OLD | NEW |