| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/filters/ffmpeg_audio_decoder.h" | 5 #include "media/filters/ffmpeg_audio_decoder.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "media/base/audio_decoder_config.h" |
| 8 #include "media/base/data_buffer.h" | 9 #include "media/base/data_buffer.h" |
| 9 #include "media/base/demuxer.h" | 10 #include "media/base/demuxer.h" |
| 10 #include "media/base/filter_host.h" | 11 #include "media/base/filter_host.h" |
| 11 #include "media/ffmpeg/ffmpeg_common.h" | 12 #include "media/ffmpeg/ffmpeg_common.h" |
| 12 | 13 |
| 13 namespace media { | 14 namespace media { |
| 14 | 15 |
| 15 // Returns true if the decode result was an error. | 16 // Returns true if the decode result was an error. |
| 16 static bool IsErrorResult(int result, int decoded_size) { | 17 static bool IsErrorResult(int result, int decoded_size) { |
| 17 return result < 0 || | 18 return result < 0 || |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 | 283 |
| 283 base::TimeDelta FFmpegAudioDecoder::CalculateDuration(int size) { | 284 base::TimeDelta FFmpegAudioDecoder::CalculateDuration(int size) { |
| 284 int64 denominator = ChannelLayoutToChannelCount(channel_layout_) * | 285 int64 denominator = ChannelLayoutToChannelCount(channel_layout_) * |
| 285 bits_per_channel_ / 8 * samples_per_second_; | 286 bits_per_channel_ / 8 * samples_per_second_; |
| 286 double microseconds = size / | 287 double microseconds = size / |
| 287 (denominator / static_cast<double>(base::Time::kMicrosecondsPerSecond)); | 288 (denominator / static_cast<double>(base::Time::kMicrosecondsPerSecond)); |
| 288 return base::TimeDelta::FromMicroseconds(static_cast<int64>(microseconds)); | 289 return base::TimeDelta::FromMicroseconds(static_cast<int64>(microseconds)); |
| 289 } | 290 } |
| 290 | 291 |
| 291 } // namespace media | 292 } // namespace media |
| OLD | NEW |