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

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

Issue 177333003: Add support for midstream audio configuration changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ABS
Patch Set: add Reset() tests. Only enable ABC in MSE case. Created 6 years, 9 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/time/time.h" 9 #include "base/time/time.h"
10 #include "media/base/audio_decoder.h" 10 #include "media/base/audio_decoder.h"
(...skipping 17 matching lines...) Expand all
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.
34 virtual void Initialize(const AudioDecoderConfig& config, 34 virtual void Initialize(const AudioDecoderConfig& config,
35 const PipelineStatusCB& status_cb) OVERRIDE; 35 const PipelineStatusCB& status_cb) OVERRIDE;
36 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, 36 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer,
37 const DecodeCB& decode_cb) OVERRIDE; 37 const DecodeCB& decode_cb) OVERRIDE;
38 virtual int bits_per_channel() OVERRIDE;
39 virtual ChannelLayout channel_layout() OVERRIDE;
40 virtual int samples_per_second() OVERRIDE;
41 virtual void Reset(const base::Closure& closure) OVERRIDE; 38 virtual void Reset(const base::Closure& closure) OVERRIDE;
42 virtual void Stop(const base::Closure& closure) OVERRIDE; 39 virtual void Stop(const base::Closure& closure) OVERRIDE;
43 40
44 private: 41 private:
45 void DoReset(); 42 void DoReset();
46 void DoStop(); 43 void DoStop();
47 44
48 // Reads from the demuxer stream with corresponding callback method. 45 // Reads from the demuxer stream with corresponding callback method.
49 void ReadFromDemuxerStream(); 46 void ReadFromDemuxerStream();
50 void DecodeBuffer(const scoped_refptr<DecoderBuffer>& input, 47 void DecodeBuffer(const scoped_refptr<DecoderBuffer>& input,
51 const DecodeCB& decode_cb); 48 const DecodeCB& decode_cb);
52 49
53 bool ConfigureDecoder(); 50 bool ConfigureDecoder();
54 void CloseDecoder(); 51 void CloseDecoder();
55 void ResetTimestampState(); 52 void ResetTimestampState();
56 bool Decode(const scoped_refptr<DecoderBuffer>& input, 53 bool Decode(const scoped_refptr<DecoderBuffer>& input,
57 scoped_refptr<AudioBuffer>* output_buffer); 54 scoped_refptr<AudioBuffer>* output_buffer);
58 55
59 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 56 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
60 57
61 AudioDecoderConfig config_; 58 AudioDecoderConfig config_;
62 OpusMSDecoder* opus_decoder_; 59 OpusMSDecoder* opus_decoder_;
63 60
64 // Decoded audio format.
65 ChannelLayout channel_layout_;
66 int samples_per_second_;
67 const SampleFormat sample_format_;
68 const int bits_per_channel_;
69
70 // Used for computing output timestamps. 61 // Used for computing output timestamps.
71 scoped_ptr<AudioTimestampHelper> output_timestamp_helper_; 62 scoped_ptr<AudioTimestampHelper> output_timestamp_helper_;
72 base::TimeDelta last_input_timestamp_; 63 base::TimeDelta last_input_timestamp_;
73 64
74 // Number of frames to be discarded from the start of the packet. This value 65 // Number of frames to be discarded from the start of the packet. This value
75 // is respected for all packets except for the first one in the stream. For 66 // is respected for all packets except for the first one in the stream. For
76 // the first packet in the stream, |frame_delay_at_start_| is used. This is 67 // the first packet in the stream, |frame_delay_at_start_| is used. This is
77 // usually set to the SeekPreRoll value from the container whenever a seek 68 // usually set to the SeekPreRoll value from the container whenever a seek
78 // happens. 69 // happens.
79 int frames_to_discard_; 70 int frames_to_discard_;
80 71
81 // Number of frames to be discarded at the start of the stream. This value 72 // Number of frames to be discarded at the start of the stream. This value
82 // is typically the CodecDelay value from the container. This value should 73 // is typically the CodecDelay value from the container. This value should
83 // only be applied when input timestamp is |start_input_timestamp_|. 74 // only be applied when input timestamp is |start_input_timestamp_|.
84 int frame_delay_at_start_; 75 int frame_delay_at_start_;
85 base::TimeDelta start_input_timestamp_; 76 base::TimeDelta start_input_timestamp_;
86 77
87 // Timestamp to be subtracted from all the frames. This is typically computed 78 // Timestamp to be subtracted from all the frames. This is typically computed
88 // from the CodecDelay value in the container. 79 // from the CodecDelay value in the container.
89 base::TimeDelta timestamp_offset_; 80 base::TimeDelta timestamp_offset_;
90 81
91 DISALLOW_IMPLICIT_CONSTRUCTORS(OpusAudioDecoder); 82 DISALLOW_IMPLICIT_CONSTRUCTORS(OpusAudioDecoder);
92 }; 83 };
93 84
94 } // namespace media 85 } // namespace media
95 86
96 #endif // MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_ 87 #endif // MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698