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

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

Issue 126793002: Add Stop() to AudioDecoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use BTCL in decoders and not ARI 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_OPUS_AUDIO_DECODER_H_ 5 #ifndef MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_
6 #define MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_ 6 #define MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 22 matching lines...) Expand all
33 33
34 // AudioDecoder implementation. 34 // AudioDecoder implementation.
35 virtual void Initialize(DemuxerStream* stream, 35 virtual void Initialize(DemuxerStream* stream,
36 const PipelineStatusCB& status_cb, 36 const PipelineStatusCB& status_cb,
37 const StatisticsCB& statistics_cb) OVERRIDE; 37 const StatisticsCB& statistics_cb) OVERRIDE;
38 virtual void Read(const ReadCB& read_cb) OVERRIDE; 38 virtual void Read(const ReadCB& read_cb) OVERRIDE;
39 virtual int bits_per_channel() OVERRIDE; 39 virtual int bits_per_channel() OVERRIDE;
40 virtual ChannelLayout channel_layout() OVERRIDE; 40 virtual ChannelLayout channel_layout() OVERRIDE;
41 virtual int samples_per_second() OVERRIDE; 41 virtual int samples_per_second() OVERRIDE;
42 virtual void Reset(const base::Closure& closure) OVERRIDE; 42 virtual void Reset(const base::Closure& closure) OVERRIDE;
43 virtual void Stop(const base::Closure& closure) OVERRIDE;
43 44
44 private: 45 private:
46 void DoReset();
47 void DoStop();
48
45 // Reads from the demuxer stream with corresponding callback method. 49 // Reads from the demuxer stream with corresponding callback method.
46 void ReadFromDemuxerStream(); 50 void ReadFromDemuxerStream();
47 void BufferReady(DemuxerStream::Status status, 51 void BufferReady(DemuxerStream::Status status,
48 const scoped_refptr<DecoderBuffer>& input); 52 const scoped_refptr<DecoderBuffer>& input);
49 53
50
51 bool ConfigureDecoder(); 54 bool ConfigureDecoder();
52 void CloseDecoder(); 55 void CloseDecoder();
53 void ResetTimestampState(); 56 void ResetTimestampState();
54 bool Decode(const scoped_refptr<DecoderBuffer>& input, 57 bool Decode(const scoped_refptr<DecoderBuffer>& input,
55 scoped_refptr<AudioBuffer>* output_buffer); 58 scoped_refptr<AudioBuffer>* output_buffer);
56 59
57 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 60 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
58 base::WeakPtrFactory<OpusAudioDecoder> weak_factory_; 61 base::WeakPtrFactory<OpusAudioDecoder> weak_factory_;
59 base::WeakPtr<OpusAudioDecoder> weak_this_; 62 base::WeakPtr<OpusAudioDecoder> weak_this_;
60 63
61 DemuxerStream* demuxer_stream_; 64 DemuxerStream* demuxer_stream_;
62 StatisticsCB statistics_cb_; 65 StatisticsCB statistics_cb_;
63 OpusMSDecoder* opus_decoder_; 66 OpusMSDecoder* opus_decoder_;
64 67
65 // Decoded audio format. 68 // Decoded audio format.
66 ChannelLayout channel_layout_; 69 ChannelLayout channel_layout_;
67 int samples_per_second_; 70 int samples_per_second_;
68 const SampleFormat sample_format_; 71 const SampleFormat sample_format_;
69 const int bits_per_channel_; 72 const int bits_per_channel_;
70 73
71 // Used for computing output timestamps. 74 // Used for computing output timestamps.
72 scoped_ptr<AudioTimestampHelper> output_timestamp_helper_; 75 scoped_ptr<AudioTimestampHelper> output_timestamp_helper_;
73 base::TimeDelta last_input_timestamp_; 76 base::TimeDelta last_input_timestamp_;
74 77
75 ReadCB read_cb_; 78 ReadCB read_cb_;
79 base::Closure stop_cb_;
80 base::Closure reset_cb_;
xhwang 2014/01/10 18:58:51 nit: change the order of these two
76 81
77 // Number of frames to be discarded from the start of the packet. This value 82 // Number of frames to be discarded from the start of the packet. This value
78 // is respected for all packets except for the first one in the stream. For 83 // is respected for all packets except for the first one in the stream. For
79 // the first packet in the stream, |frame_delay_at_start_| is used. This is 84 // the first packet in the stream, |frame_delay_at_start_| is used. This is
80 // usually set to the SeekPreRoll value from the container whenever a seek 85 // usually set to the SeekPreRoll value from the container whenever a seek
81 // happens. 86 // happens.
82 int frames_to_discard_; 87 int frames_to_discard_;
83 88
84 // Number of frames to be discarded at the start of the stream. This value 89 // Number of frames to be discarded at the start of the stream. This value
85 // is typically the CodecDelay value from the container. This value should 90 // is typically the CodecDelay value from the container. This value should
86 // only be applied when input timestamp is |start_input_timestamp_|. 91 // only be applied when input timestamp is |start_input_timestamp_|.
87 int frame_delay_at_start_; 92 int frame_delay_at_start_;
88 base::TimeDelta start_input_timestamp_; 93 base::TimeDelta start_input_timestamp_;
89 94
90 // Timestamp to be subtracted from all the frames. This is typically computed 95 // Timestamp to be subtracted from all the frames. This is typically computed
91 // from the CodecDelay value in the container. 96 // from the CodecDelay value in the container.
92 base::TimeDelta timestamp_offset_; 97 base::TimeDelta timestamp_offset_;
93 98
94 DISALLOW_IMPLICIT_CONSTRUCTORS(OpusAudioDecoder); 99 DISALLOW_IMPLICIT_CONSTRUCTORS(OpusAudioDecoder);
95 }; 100 };
96 101
97 } // namespace media 102 } // namespace media
98 103
99 #endif // MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_ 104 #endif // MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698