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

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

Issue 10912080: Switch to AVIO instead of a custom FFmpeg URLProtocol handler. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase. Created 8 years, 1 month 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/filters/audio_file_reader.cc ('k') | media/filters/ffmpeg_audio_decoder_unittest.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) 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
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();
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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 &FFmpegAudioDecoder::DoDecodeBuffer, this, status, buffer)); 379 &FFmpegAudioDecoder::DoDecodeBuffer, this, status, buffer));
380 } 380 }
381 381
382 base::TimeDelta FFmpegAudioDecoder::GetNextOutputTimestamp() const { 382 base::TimeDelta FFmpegAudioDecoder::GetNextOutputTimestamp() const {
383 DCHECK(output_timestamp_base_ != kNoTimestamp()); 383 DCHECK(output_timestamp_base_ != kNoTimestamp());
384 double decoded_us = (total_frames_decoded_ / samples_per_second_) * 384 double decoded_us = (total_frames_decoded_ / samples_per_second_) *
385 base::Time::kMicrosecondsPerSecond; 385 base::Time::kMicrosecondsPerSecond;
386 return output_timestamp_base_ + base::TimeDelta::FromMicroseconds(decoded_us); 386 return output_timestamp_base_ + base::TimeDelta::FromMicroseconds(decoded_us);
387 } 387 }
388 } // namespace media 388 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/audio_file_reader.cc ('k') | media/filters/ffmpeg_audio_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698