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

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

Issue 14217008: Remove reference counting from media::DemuxerStream and friends. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 8 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/ffmpeg_audio_decoder.h ('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 23 matching lines...) Expand all
34 // 1. FFmpeg didn't read anything. 34 // 1. FFmpeg didn't read anything.
35 // 2. FFmpeg didn't output anything. 35 // 2. FFmpeg didn't output anything.
36 // 3. An end of stream buffer is received. 36 // 3. An end of stream buffer is received.
37 return result == 0 && decoded_size == 0 && input->IsEndOfStream(); 37 return result == 0 && decoded_size == 0 && input->IsEndOfStream();
38 } 38 }
39 39
40 FFmpegAudioDecoder::FFmpegAudioDecoder( 40 FFmpegAudioDecoder::FFmpegAudioDecoder(
41 const scoped_refptr<base::MessageLoopProxy>& message_loop) 41 const scoped_refptr<base::MessageLoopProxy>& message_loop)
42 : message_loop_(message_loop), 42 : message_loop_(message_loop),
43 weak_factory_(this), 43 weak_factory_(this),
44 demuxer_stream_(NULL),
44 codec_context_(NULL), 45 codec_context_(NULL),
45 bits_per_channel_(0), 46 bits_per_channel_(0),
46 channel_layout_(CHANNEL_LAYOUT_NONE), 47 channel_layout_(CHANNEL_LAYOUT_NONE),
47 channels_(0), 48 channels_(0),
48 samples_per_second_(0), 49 samples_per_second_(0),
49 av_sample_format_(0), 50 av_sample_format_(0),
50 bytes_per_frame_(0), 51 bytes_per_frame_(0),
51 last_input_timestamp_(kNoTimestamp()), 52 last_input_timestamp_(kNoTimestamp()),
52 output_bytes_to_drop_(0), 53 output_bytes_to_drop_(0),
53 av_frame_(NULL) { 54 av_frame_(NULL) {
54 } 55 }
55 56
56 void FFmpegAudioDecoder::Initialize( 57 void FFmpegAudioDecoder::Initialize(
57 const scoped_refptr<DemuxerStream>& stream, 58 DemuxerStream* stream,
58 const PipelineStatusCB& status_cb, 59 const PipelineStatusCB& status_cb,
59 const StatisticsCB& statistics_cb) { 60 const StatisticsCB& statistics_cb) {
60 DCHECK(message_loop_->BelongsToCurrentThread()); 61 DCHECK(message_loop_->BelongsToCurrentThread());
61 PipelineStatusCB initialize_cb = BindToCurrentLoop(status_cb); 62 PipelineStatusCB initialize_cb = BindToCurrentLoop(status_cb);
62 63
63 FFmpegGlue::InitializeFFmpeg(); 64 FFmpegGlue::InitializeFFmpeg();
64 65
65 if (demuxer_stream_) { 66 if (demuxer_stream_) {
66 // TODO(scherkus): initialization currently happens more than once in 67 // TODO(scherkus): initialization currently happens more than once in
67 // PipelineIntegrationTest.BasicPlayback. 68 // PipelineIntegrationTest.BasicPlayback.
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 // Decoding finished successfully, update statistics. 498 // Decoding finished successfully, update statistics.
498 if (result > 0) { 499 if (result > 0) {
499 PipelineStatistics statistics; 500 PipelineStatistics statistics;
500 statistics.audio_bytes_decoded = result; 501 statistics.audio_bytes_decoded = result;
501 statistics_cb_.Run(statistics); 502 statistics_cb_.Run(statistics);
502 } 503 }
503 } while (packet.size > 0); 504 } while (packet.size > 0);
504 } 505 }
505 506
506 } // namespace media 507 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_audio_decoder.h ('k') | media/filters/ffmpeg_audio_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698