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

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

Issue 65803002: Replace MessageLoopProxy with SingleThreadTaskRunner for media/filters/ + associated code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years 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
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"
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 #include "media/base/sample_format.h"
14 14
15 struct OpusMSDecoder; 15 struct OpusMSDecoder;
16 16
17 namespace base { 17 namespace base {
18 class MessageLoopProxy; 18 class SingleThreadTaskRunner;
19 } 19 }
20 20
21 namespace media { 21 namespace media {
22 22
23 class AudioBuffer; 23 class AudioBuffer;
24 class AudioTimestampHelper; 24 class AudioTimestampHelper;
25 class DecoderBuffer; 25 class DecoderBuffer;
26 struct QueuedAudioBuffer; 26 struct QueuedAudioBuffer;
27 27
28 class MEDIA_EXPORT OpusAudioDecoder : public AudioDecoder { 28 class MEDIA_EXPORT OpusAudioDecoder : public AudioDecoder {
29 public: 29 public:
30 explicit OpusAudioDecoder( 30 explicit OpusAudioDecoder(
31 const scoped_refptr<base::MessageLoopProxy>& message_loop); 31 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
32 virtual ~OpusAudioDecoder(); 32 virtual ~OpusAudioDecoder();
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 43
44 private: 44 private:
45 // Reads from the demuxer stream with corresponding callback method. 45 // Reads from the demuxer stream with corresponding callback method.
46 void ReadFromDemuxerStream(); 46 void ReadFromDemuxerStream();
47 void BufferReady(DemuxerStream::Status status, 47 void BufferReady(DemuxerStream::Status status,
48 const scoped_refptr<DecoderBuffer>& input); 48 const scoped_refptr<DecoderBuffer>& input);
49 49
50 50
51 bool ConfigureDecoder(); 51 bool ConfigureDecoder();
52 void CloseDecoder(); 52 void CloseDecoder();
53 void ResetTimestampState(); 53 void ResetTimestampState();
54 bool Decode(const scoped_refptr<DecoderBuffer>& input, 54 bool Decode(const scoped_refptr<DecoderBuffer>& input,
55 scoped_refptr<AudioBuffer>* output_buffer); 55 scoped_refptr<AudioBuffer>* output_buffer);
56 56
57 scoped_refptr<base::MessageLoopProxy> message_loop_; 57 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
58 base::WeakPtrFactory<OpusAudioDecoder> weak_factory_; 58 base::WeakPtrFactory<OpusAudioDecoder> weak_factory_;
59 base::WeakPtr<OpusAudioDecoder> weak_this_; 59 base::WeakPtr<OpusAudioDecoder> weak_this_;
60 60
61 DemuxerStream* demuxer_stream_; 61 DemuxerStream* demuxer_stream_;
62 StatisticsCB statistics_cb_; 62 StatisticsCB statistics_cb_;
63 OpusMSDecoder* opus_decoder_; 63 OpusMSDecoder* opus_decoder_;
64 64
65 // Decoded audio format. 65 // Decoded audio format.
66 ChannelLayout channel_layout_; 66 ChannelLayout channel_layout_;
67 int samples_per_second_; 67 int samples_per_second_;
(...skipping 22 matching lines...) Expand all
90 // 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
91 // from the CodecDelay value in the container. 91 // from the CodecDelay value in the container.
92 base::TimeDelta timestamp_offset_; 92 base::TimeDelta timestamp_offset_;
93 93
94 DISALLOW_IMPLICIT_CONSTRUCTORS(OpusAudioDecoder); 94 DISALLOW_IMPLICIT_CONSTRUCTORS(OpusAudioDecoder);
95 }; 95 };
96 96
97 } // namespace media 97 } // namespace media
98 98
99 #endif // MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_ 99 #endif // MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_
OLDNEW
« no previous file with comments | « media/filters/mock_gpu_video_accelerator_factories.h ('k') | media/filters/opus_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698