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

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

Issue 7062013: Move media library AutoTaskRunner to base and rename ScopedTaskRunner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add innocuous but critical BASE_API modifier to ScopedTaskRunner declaration. Created 9 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « media/filters/decoder_base_unittest.cc ('k') | remoting/client/rectangle_update_decoder.cc » ('j') | 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) 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 "media/base/callback.h"
8 #include "media/base/data_buffer.h" 7 #include "media/base/data_buffer.h"
9 #include "media/base/limits.h" 8 #include "media/base/limits.h"
10 #include "media/ffmpeg/ffmpeg_common.h" 9 #include "media/ffmpeg/ffmpeg_common.h"
11 #include "media/filters/ffmpeg_demuxer.h" 10 #include "media/filters/ffmpeg_demuxer.h"
12 11
13 #if !defined(USE_SSE) 12 #if !defined(USE_SSE)
14 #if defined(__SSE__) || defined(ARCH_CPU_X86_64) || _M_IX86_FP==1 13 #if defined(__SSE__) || defined(ARCH_CPU_X86_64) || _M_IX86_FP==1
15 #define USE_SSE 1 14 #define USE_SSE 1
16 #else 15 #else
17 #define USE_SSE 0 16 #define USE_SSE 0
(...skipping 15 matching lines...) Expand all
33 config_(0, CHANNEL_LAYOUT_NONE, 0), 32 config_(0, CHANNEL_LAYOUT_NONE, 0),
34 estimated_next_timestamp_(kNoTimestamp) { 33 estimated_next_timestamp_(kNoTimestamp) {
35 } 34 }
36 35
37 FFmpegAudioDecoder::~FFmpegAudioDecoder() { 36 FFmpegAudioDecoder::~FFmpegAudioDecoder() {
38 } 37 }
39 38
40 void FFmpegAudioDecoder::DoInitialize(DemuxerStream* demuxer_stream, 39 void FFmpegAudioDecoder::DoInitialize(DemuxerStream* demuxer_stream,
41 bool* success, 40 bool* success,
42 Task* done_cb) { 41 Task* done_cb) {
43 AutoTaskRunner done_runner(done_cb); 42 base::ScopedTaskRunner done_runner(done_cb);
44 *success = false; 43 *success = false;
45 44
46 AVStream* av_stream = demuxer_stream->GetAVStream(); 45 AVStream* av_stream = demuxer_stream->GetAVStream();
47 if (!av_stream) { 46 if (!av_stream) {
48 return; 47 return;
49 } 48 }
50 49
51 // Grab the AVStream's codec context and make sure we have sensible values. 50 // Grab the AVStream's codec context and make sure we have sensible values.
52 codec_context_ = av_stream->codec; 51 codec_context_ = av_stream->codec;
53 int bps = av_get_bits_per_sample_fmt(codec_context_->sample_fmt); 52 int bps = av_get_bits_per_sample_fmt(codec_context_->sample_fmt);
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 base::TimeDelta FFmpegAudioDecoder::CalculateDuration(size_t size) { 252 base::TimeDelta FFmpegAudioDecoder::CalculateDuration(size_t size) {
254 int64 denominator = codec_context_->channels * 253 int64 denominator = codec_context_->channels *
255 av_get_bits_per_sample_fmt(codec_context_->sample_fmt) / 8 * 254 av_get_bits_per_sample_fmt(codec_context_->sample_fmt) / 8 *
256 codec_context_->sample_rate; 255 codec_context_->sample_rate;
257 double microseconds = size / 256 double microseconds = size /
258 (denominator / static_cast<double>(base::Time::kMicrosecondsPerSecond)); 257 (denominator / static_cast<double>(base::Time::kMicrosecondsPerSecond));
259 return base::TimeDelta::FromMicroseconds(static_cast<int64>(microseconds)); 258 return base::TimeDelta::FromMicroseconds(static_cast<int64>(microseconds));
260 } 259 }
261 260
262 } // namespace 261 } // namespace
OLDNEW
« no previous file with comments | « media/filters/decoder_base_unittest.cc ('k') | remoting/client/rectangle_update_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698