OLD | NEW |
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 Loading... |
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_ |
OLD | NEW |