| OLD | NEW |
| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 config.samples_per_second > 0 && | 181 config.samples_per_second > 0 && |
| 182 config.samples_per_second <= media::limits::kMaxSampleRate; | 182 config.samples_per_second <= media::limits::kMaxSampleRate; |
| 183 } | 183 } |
| 184 | 184 |
| 185 cdm::Status FFmpegCdmAudioDecoder::DecodeBuffer( | 185 cdm::Status FFmpegCdmAudioDecoder::DecodeBuffer( |
| 186 const uint8_t* compressed_buffer, | 186 const uint8_t* compressed_buffer, |
| 187 int32_t compressed_buffer_size, | 187 int32_t compressed_buffer_size, |
| 188 int64_t input_timestamp, | 188 int64_t input_timestamp, |
| 189 cdm::AudioFrames* decoded_frames) { | 189 cdm::AudioFrames* decoded_frames) { |
| 190 DVLOG(1) << "DecodeBuffer()"; | 190 DVLOG(1) << "DecodeBuffer()"; |
| 191 const bool is_end_of_stream = compressed_buffer_size == 0; | 191 const bool is_end_of_stream = !compressed_buffer; |
| 192 base::TimeDelta timestamp = | 192 base::TimeDelta timestamp = |
| 193 base::TimeDelta::FromMicroseconds(input_timestamp); | 193 base::TimeDelta::FromMicroseconds(input_timestamp); |
| 194 | 194 |
| 195 bool is_vorbis = codec_context_->codec_id == CODEC_ID_VORBIS; | 195 bool is_vorbis = codec_context_->codec_id == CODEC_ID_VORBIS; |
| 196 if (!is_end_of_stream) { | 196 if (!is_end_of_stream) { |
| 197 if (last_input_timestamp_ == media::kNoTimestamp()) { | 197 if (last_input_timestamp_ == media::kNoTimestamp()) { |
| 198 if (is_vorbis && timestamp < base::TimeDelta()) { | 198 if (is_vorbis && timestamp < base::TimeDelta()) { |
| 199 // Dropping frames for negative timestamps as outlined in section A.2 | 199 // Dropping frames for negative timestamps as outlined in section A.2 |
| 200 // in the Vorbis spec. http://xiph.org/vorbis/doc/Vorbis_I_spec.html | 200 // in the Vorbis spec. http://xiph.org/vorbis/doc/Vorbis_I_spec.html |
| 201 int frames_to_drop = floor( | 201 int frames_to_drop = floor( |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |