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/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "media/base/audio_decoder.h" | 11 #include "media/base/audio_decoder.h" |
12 #include "media/base/demuxer_stream.h" | 12 #include "media/base/demuxer_stream.h" |
| 13 #include "media/base/sample_format.h" |
13 | 14 |
14 struct OpusMSDecoder; | 15 struct OpusMSDecoder; |
15 | 16 |
16 namespace base { | 17 namespace base { |
17 class MessageLoopProxy; | 18 class MessageLoopProxy; |
18 } | 19 } |
19 | 20 |
20 namespace media { | 21 namespace media { |
21 | 22 |
22 class AudioBuffer; | 23 class AudioBuffer; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 56 |
56 scoped_refptr<base::MessageLoopProxy> message_loop_; | 57 scoped_refptr<base::MessageLoopProxy> message_loop_; |
57 base::WeakPtrFactory<OpusAudioDecoder> weak_factory_; | 58 base::WeakPtrFactory<OpusAudioDecoder> weak_factory_; |
58 base::WeakPtr<OpusAudioDecoder> weak_this_; | 59 base::WeakPtr<OpusAudioDecoder> weak_this_; |
59 | 60 |
60 DemuxerStream* demuxer_stream_; | 61 DemuxerStream* demuxer_stream_; |
61 StatisticsCB statistics_cb_; | 62 StatisticsCB statistics_cb_; |
62 OpusMSDecoder* opus_decoder_; | 63 OpusMSDecoder* opus_decoder_; |
63 | 64 |
64 // Decoded audio format. | 65 // Decoded audio format. |
65 int bits_per_channel_; | |
66 ChannelLayout channel_layout_; | 66 ChannelLayout channel_layout_; |
67 int samples_per_second_; | 67 int samples_per_second_; |
| 68 const SampleFormat sample_format_; |
| 69 const int bits_per_channel_; |
68 | 70 |
69 // Used for computing output timestamps. | 71 // Used for computing output timestamps. |
70 scoped_ptr<AudioTimestampHelper> output_timestamp_helper_; | 72 scoped_ptr<AudioTimestampHelper> output_timestamp_helper_; |
71 base::TimeDelta last_input_timestamp_; | 73 base::TimeDelta last_input_timestamp_; |
72 | 74 |
73 ReadCB read_cb_; | 75 ReadCB read_cb_; |
74 | 76 |
75 // Number of frames to be discarded from the start of the packet. This value | 77 // Number of frames to be discarded from the start of the packet. This value |
76 // is respected for all packets except for the first one in the stream. For | 78 // is respected for all packets except for the first one in the stream. For |
77 // the first packet in the stream, |frame_delay_at_start_| is used. This is | 79 // the first packet in the stream, |frame_delay_at_start_| is used. This is |
78 // usually set to the SeekPreRoll value from the container whenever a seek | 80 // usually set to the SeekPreRoll value from the container whenever a seek |
79 // happens. | 81 // happens. |
80 int frames_to_discard_; | 82 int frames_to_discard_; |
81 | 83 |
82 // Number of frames to be discarded at the start of the stream. This value | 84 // Number of frames to be discarded at the start of the stream. This value |
83 // is typically the CodecDelay value from the container. | 85 // is typically the CodecDelay value from the container. This value should |
| 86 // only be applied when input timestamp is |start_input_timestamp_|. |
84 int frame_delay_at_start_; | 87 int frame_delay_at_start_; |
| 88 base::TimeDelta start_input_timestamp_; |
85 | 89 |
86 // Timestamp to be subtracted from all the frames. This is typically computed | 90 // Timestamp to be subtracted from all the frames. This is typically computed |
87 // from the CodecDelay value in the container. | 91 // from the CodecDelay value in the container. |
88 base::TimeDelta timestamp_offset_; | 92 base::TimeDelta timestamp_offset_; |
89 | 93 |
90 // Buffer for output from libopus. | |
91 scoped_ptr<int16[]> output_buffer_; | |
92 | |
93 DISALLOW_IMPLICIT_CONSTRUCTORS(OpusAudioDecoder); | 94 DISALLOW_IMPLICIT_CONSTRUCTORS(OpusAudioDecoder); |
94 }; | 95 }; |
95 | 96 |
96 } // namespace media | 97 } // namespace media |
97 | 98 |
98 #endif // MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_ | 99 #endif // MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_ |
OLD | NEW |