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

Side by Side Diff: media/filters/ffmpeg_audio_decoder.cc

Issue 3077004: Updated some comments to point at bugs in ffmpeg_unittest.cc and ffmpeg_audio_decoder.cc. (Closed)
Patch Set: Created 10 years, 4 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
« no previous file with comments | « media/ffmpeg/ffmpeg_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "media/base/callback.h" 7 #include "media/base/callback.h"
8 #include "media/base/data_buffer.h" 8 #include "media/base/data_buffer.h"
9 #include "media/base/limits.h" 9 #include "media/base/limits.h"
10 #include "media/ffmpeg/ffmpeg_common.h" 10 #include "media/ffmpeg/ffmpeg_common.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 #endif 150 #endif
151 static void ConvertAudioF32ToS32(void* buffer, int buffer_size) { 151 static void ConvertAudioF32ToS32(void* buffer, int buffer_size) {
152 for (int i = 0; i < buffer_size / 4; ++i) { 152 for (int i = 0; i < buffer_size / 4; ++i) {
153 FloatToIntSaturate(reinterpret_cast<float*>(buffer) + i); 153 FloatToIntSaturate(reinterpret_cast<float*>(buffer) + i);
154 } 154 }
155 } 155 }
156 156
157 void FFmpegAudioDecoder::DoDecode(Buffer* input) { 157 void FFmpegAudioDecoder::DoDecode(Buffer* input) {
158 // FFmpeg tends to seek Ogg audio streams in the middle of nowhere, giving us 158 // FFmpeg tends to seek Ogg audio streams in the middle of nowhere, giving us
159 // a whole bunch of AV_NOPTS_VALUE packets. Discard them until we find 159 // a whole bunch of AV_NOPTS_VALUE packets. Discard them until we find
160 // something valid. 160 // something valid. Refer to http://crbug.com/49709
161 // TODO(hclam): remove this once fixing the issue in FFmpeg. 161 // TODO(hclam): remove this once fixing the issue in FFmpeg.
162 if (input->GetTimestamp() == StreamSample::kInvalidTimestamp && 162 if (input->GetTimestamp() == StreamSample::kInvalidTimestamp &&
163 estimated_next_timestamp_ == StreamSample::kInvalidTimestamp && 163 estimated_next_timestamp_ == StreamSample::kInvalidTimestamp &&
164 !input->IsEndOfStream()) { 164 !input->IsEndOfStream()) {
165 DecoderBase<AudioDecoder, Buffer>::OnDecodeComplete(); 165 DecoderBase<AudioDecoder, Buffer>::OnDecodeComplete();
166 return; 166 return;
167 } 167 }
168 168
169 // Due to FFmpeg API changes we no longer have const read-only pointers. 169 // Due to FFmpeg API changes we no longer have const read-only pointers.
170 AVPacket packet; 170 AVPacket packet;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 base::TimeDelta FFmpegAudioDecoder::CalculateDuration(size_t size) { 256 base::TimeDelta FFmpegAudioDecoder::CalculateDuration(size_t size) {
257 int64 denominator = codec_context_->channels * 257 int64 denominator = codec_context_->channels *
258 av_get_bits_per_sample_format(codec_context_->sample_fmt) / 8 * 258 av_get_bits_per_sample_format(codec_context_->sample_fmt) / 8 *
259 codec_context_->sample_rate; 259 codec_context_->sample_rate;
260 double microseconds = size / 260 double microseconds = size /
261 (denominator / static_cast<double>(base::Time::kMicrosecondsPerSecond)); 261 (denominator / static_cast<double>(base::Time::kMicrosecondsPerSecond));
262 return base::TimeDelta::FromMicroseconds(static_cast<int64>(microseconds)); 262 return base::TimeDelta::FromMicroseconds(static_cast<int64>(microseconds));
263 } 263 }
264 264
265 } // namespace 265 } // namespace
OLDNEW
« no previous file with comments | « media/ffmpeg/ffmpeg_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698