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

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

Issue 259453003: Introduce AudioDiscardHelper. Refactor audio decoders to use it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix x64 type. Created 6 years, 7 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.cc ('k') | media/filters/opus_audio_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) 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/time/time.h" 9 #include "base/time/time.h"
10 #include "media/base/audio_decoder.h" 10 #include "media/base/audio_decoder.h"
11 #include "media/base/demuxer_stream.h" 11 #include "media/base/demuxer_stream.h"
12 #include "media/base/sample_format.h" 12 #include "media/base/sample_format.h"
13 13
14 struct OpusMSDecoder; 14 struct OpusMSDecoder;
15 15
16 namespace base { 16 namespace base {
17 class SingleThreadTaskRunner; 17 class SingleThreadTaskRunner;
18 } 18 }
19 19
20 namespace media { 20 namespace media {
21 21
22 class AudioBuffer; 22 class AudioBuffer;
23 class AudioTimestampHelper; 23 class AudioDiscardHelper;
24 class DecoderBuffer; 24 class DecoderBuffer;
25 struct QueuedAudioBuffer; 25 struct QueuedAudioBuffer;
26 26
27 class MEDIA_EXPORT OpusAudioDecoder : public AudioDecoder { 27 class MEDIA_EXPORT OpusAudioDecoder : public AudioDecoder {
28 public: 28 public:
29 explicit OpusAudioDecoder( 29 explicit OpusAudioDecoder(
30 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); 30 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
31 virtual ~OpusAudioDecoder(); 31 virtual ~OpusAudioDecoder();
32 32
33 // AudioDecoder implementation. 33 // AudioDecoder implementation.
(...skipping 14 matching lines...) Expand all
48 void CloseDecoder(); 48 void CloseDecoder();
49 void ResetTimestampState(); 49 void ResetTimestampState();
50 bool Decode(const scoped_refptr<DecoderBuffer>& input, 50 bool Decode(const scoped_refptr<DecoderBuffer>& input,
51 scoped_refptr<AudioBuffer>* output_buffer); 51 scoped_refptr<AudioBuffer>* output_buffer);
52 52
53 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 53 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
54 54
55 AudioDecoderConfig config_; 55 AudioDecoderConfig config_;
56 OpusMSDecoder* opus_decoder_; 56 OpusMSDecoder* opus_decoder_;
57 57
58 // Used for computing output timestamps.
59 scoped_ptr<AudioTimestampHelper> output_timestamp_helper_;
60 base::TimeDelta last_input_timestamp_;
61
62 // Number of frames to be discarded from the start of the packet. This value
63 // is respected for all packets except for the first one in the stream. For
64 // the first packet in the stream, |frame_delay_at_start_| is used. This is
65 // usually set to the SeekPreRoll value from the container whenever a seek
66 // happens.
67 int frames_to_discard_;
68
69 // When the input timestamp is |start_input_timestamp_| the decoder needs to 58 // When the input timestamp is |start_input_timestamp_| the decoder needs to
70 // drop |config_.codec_delay()| frames. 59 // drop |config_.codec_delay()| frames.
71 base::TimeDelta start_input_timestamp_; 60 base::TimeDelta start_input_timestamp_;
72 61
62 scoped_ptr<AudioDiscardHelper> discard_helper_;
63
73 DISALLOW_IMPLICIT_CONSTRUCTORS(OpusAudioDecoder); 64 DISALLOW_IMPLICIT_CONSTRUCTORS(OpusAudioDecoder);
74 }; 65 };
75 66
76 } // namespace media 67 } // namespace media
77 68
78 #endif // MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_ 69 #endif // MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_audio_decoder.cc ('k') | media/filters/opus_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698