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

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

Issue 140823012: Reland: Add Stop() to AudioDecoder. (https://codereview.chromium.org/126793002/) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove extra scope Created 6 years, 11 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
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 #ifndef MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ 5 #ifndef MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_
6 #define MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ 6 #define MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 27 matching lines...) Expand all
38 38
39 // AudioDecoder implementation. 39 // AudioDecoder implementation.
40 virtual void Initialize(DemuxerStream* stream, 40 virtual void Initialize(DemuxerStream* stream,
41 const PipelineStatusCB& status_cb, 41 const PipelineStatusCB& status_cb,
42 const StatisticsCB& statistics_cb) OVERRIDE; 42 const StatisticsCB& statistics_cb) OVERRIDE;
43 virtual void Read(const ReadCB& read_cb) OVERRIDE; 43 virtual void Read(const ReadCB& read_cb) OVERRIDE;
44 virtual int bits_per_channel() OVERRIDE; 44 virtual int bits_per_channel() OVERRIDE;
45 virtual ChannelLayout channel_layout() OVERRIDE; 45 virtual ChannelLayout channel_layout() OVERRIDE;
46 virtual int samples_per_second() OVERRIDE; 46 virtual int samples_per_second() OVERRIDE;
47 virtual void Reset(const base::Closure& closure) OVERRIDE; 47 virtual void Reset(const base::Closure& closure) OVERRIDE;
48 virtual void Stop(const base::Closure& closure) OVERRIDE;
48 49
49 // Callback called from within FFmpeg to allocate a buffer based on 50 // Callback called from within FFmpeg to allocate a buffer based on
50 // the dimensions of |codec_context|. See AVCodecContext.get_buffer2 51 // the dimensions of |codec_context|. See AVCodecContext.get_buffer2
51 // documentation inside FFmpeg. 52 // documentation inside FFmpeg.
52 int GetAudioBuffer(AVCodecContext* codec, AVFrame* frame, int flags); 53 int GetAudioBuffer(AVCodecContext* codec, AVFrame* frame, int flags);
53 54
54 private: 55 private:
56 void DoStop();
57 void DoReset();
58
55 // Reads from the demuxer stream with corresponding callback method. 59 // Reads from the demuxer stream with corresponding callback method.
56 void ReadFromDemuxerStream(); 60 void ReadFromDemuxerStream();
57 void BufferReady(DemuxerStream::Status status, 61 void BufferReady(DemuxerStream::Status status,
58 const scoped_refptr<DecoderBuffer>& input); 62 const scoped_refptr<DecoderBuffer>& input);
59 63
60 bool ConfigureDecoder(); 64 bool ConfigureDecoder();
61 void ReleaseFFmpegResources(); 65 void ReleaseFFmpegResources();
62 void ResetTimestampState(); 66 void ResetTimestampState();
63 void RunDecodeLoop(const scoped_refptr<DecoderBuffer>& input, 67 void RunDecodeLoop(const scoped_refptr<DecoderBuffer>& input,
64 bool skip_eos_append); 68 bool skip_eos_append);
(...skipping 20 matching lines...) Expand all
85 scoped_ptr<AudioTimestampHelper> output_timestamp_helper_; 89 scoped_ptr<AudioTimestampHelper> output_timestamp_helper_;
86 base::TimeDelta last_input_timestamp_; 90 base::TimeDelta last_input_timestamp_;
87 91
88 // Number of frames to drop before generating output buffers. 92 // Number of frames to drop before generating output buffers.
89 int output_frames_to_drop_; 93 int output_frames_to_drop_;
90 94
91 // Holds decoded audio. 95 // Holds decoded audio.
92 scoped_ptr_malloc<AVFrame, ScopedPtrAVFreeFrame> av_frame_; 96 scoped_ptr_malloc<AVFrame, ScopedPtrAVFreeFrame> av_frame_;
93 97
94 ReadCB read_cb_; 98 ReadCB read_cb_;
99 base::Closure stop_cb_;
100 base::Closure reset_cb_;
95 101
96 // Since multiple frames may be decoded from the same packet we need to queue 102 // Since multiple frames may be decoded from the same packet we need to queue
97 // them up and hand them out as we receive Read() calls. 103 // them up and hand them out as we receive Read() calls.
98 std::list<QueuedAudioBuffer> queued_audio_; 104 std::list<QueuedAudioBuffer> queued_audio_;
99 105
100 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder); 106 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder);
101 }; 107 };
102 108
103 } // namespace media 109 } // namespace media
104 110
105 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ 111 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_
OLDNEW
« no previous file with comments | « media/filters/decrypting_audio_decoder_unittest.cc ('k') | media/filters/ffmpeg_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698