Chromium Code Reviews| 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 "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 "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 last_input_timestamp_(kNoTimestamp()), | 47 last_input_timestamp_(kNoTimestamp()), |
| 48 output_bytes_to_drop_(0), | 48 output_bytes_to_drop_(0), |
| 49 av_frame_(NULL) { | 49 av_frame_(NULL) { |
| 50 } | 50 } |
| 51 | 51 |
| 52 void FFmpegAudioDecoder::Initialize( | 52 void FFmpegAudioDecoder::Initialize( |
| 53 const scoped_refptr<DemuxerStream>& stream, | 53 const scoped_refptr<DemuxerStream>& stream, |
| 54 const PipelineStatusCB& status_cb, | 54 const PipelineStatusCB& status_cb, |
| 55 const StatisticsCB& statistics_cb) { | 55 const StatisticsCB& statistics_cb) { |
| 56 // Ensure FFmpeg has been initialized | 56 // Ensure FFmpeg has been initialized |
| 57 FFmpegGlue::GetInstance(); | 57 FFmpegGlue::InitializeFFmpeg(); |
|
scherkus (not reviewing)
2012/10/02 00:20:56
do you know why we still need this?
DaleCurtis
2012/10/02 01:24:23
I think it's just a safety check. The unittests ne
| |
| 58 | 58 |
| 59 if (!message_loop_) { | 59 if (!message_loop_) { |
| 60 message_loop_ = base::ResetAndReturn(&message_loop_factory_cb_).Run(); | 60 message_loop_ = base::ResetAndReturn(&message_loop_factory_cb_).Run(); |
| 61 } else { | 61 } else { |
| 62 // TODO(scherkus): initialization currently happens more than once in | 62 // TODO(scherkus): initialization currently happens more than once in |
| 63 // PipelineIntegrationTest.BasicPlayback. | 63 // PipelineIntegrationTest.BasicPlayback. |
| 64 LOG(ERROR) << "Initialize has already been called."; | 64 LOG(ERROR) << "Initialize has already been called."; |
| 65 } | 65 } |
| 66 message_loop_->PostTask( | 66 message_loop_->PostTask( |
| 67 FROM_HERE, | 67 FROM_HERE, |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 376 &FFmpegAudioDecoder::DoDecodeBuffer, this, status, buffer)); | 376 &FFmpegAudioDecoder::DoDecodeBuffer, this, status, buffer)); |
| 377 } | 377 } |
| 378 | 378 |
| 379 base::TimeDelta FFmpegAudioDecoder::GetNextOutputTimestamp() const { | 379 base::TimeDelta FFmpegAudioDecoder::GetNextOutputTimestamp() const { |
| 380 DCHECK(output_timestamp_base_ != kNoTimestamp()); | 380 DCHECK(output_timestamp_base_ != kNoTimestamp()); |
| 381 double decoded_us = (total_frames_decoded_ / samples_per_second_) * | 381 double decoded_us = (total_frames_decoded_ / samples_per_second_) * |
| 382 base::Time::kMicrosecondsPerSecond; | 382 base::Time::kMicrosecondsPerSecond; |
| 383 return output_timestamp_base_ + base::TimeDelta::FromMicroseconds(decoded_us); | 383 return output_timestamp_base_ + base::TimeDelta::FromMicroseconds(decoded_us); |
| 384 } | 384 } |
| 385 } // namespace media | 385 } // namespace media |
| OLD | NEW |