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

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

Issue 140823012: Reland: Add Stop() to AudioDecoder. (https://codereview.chromium.org/126793002/) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove extra scope Created 6 years, 11 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_DECRYPTING_AUDIO_DECODER_H_ 5 #ifndef MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_
6 #define MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_ 6 #define MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 30 matching lines...) Expand all
41 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 41 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
42 const SetDecryptorReadyCB& set_decryptor_ready_cb); 42 const SetDecryptorReadyCB& set_decryptor_ready_cb);
43 virtual ~DecryptingAudioDecoder(); 43 virtual ~DecryptingAudioDecoder();
44 44
45 // AudioDecoder implementation. 45 // AudioDecoder implementation.
46 virtual void Initialize(DemuxerStream* stream, 46 virtual void Initialize(DemuxerStream* stream,
47 const PipelineStatusCB& status_cb, 47 const PipelineStatusCB& status_cb,
48 const StatisticsCB& statistics_cb) OVERRIDE; 48 const StatisticsCB& statistics_cb) OVERRIDE;
49 virtual void Read(const ReadCB& read_cb) OVERRIDE; 49 virtual void Read(const ReadCB& read_cb) OVERRIDE;
50 virtual void Reset(const base::Closure& closure) OVERRIDE; 50 virtual void Reset(const base::Closure& closure) OVERRIDE;
51 virtual void Stop(const base::Closure& closure) OVERRIDE;
51 virtual int bits_per_channel() OVERRIDE; 52 virtual int bits_per_channel() OVERRIDE;
52 virtual ChannelLayout channel_layout() OVERRIDE; 53 virtual ChannelLayout channel_layout() OVERRIDE;
53 virtual int samples_per_second() OVERRIDE; 54 virtual int samples_per_second() OVERRIDE;
54 55
55 private: 56 private:
56 // For a detailed state diagram please see this link: http://goo.gl/8jAok 57 // For a detailed state diagram please see this link: http://goo.gl/8jAok
57 // TODO(xhwang): Add a ASCII state diagram in this file after this class 58 // TODO(xhwang): Add a ASCII state diagram in this file after this class
58 // stabilizes. 59 // stabilizes.
59 // TODO(xhwang): Update this diagram for DecryptingAudioDecoder. 60 // TODO(xhwang): Update this diagram for DecryptingAudioDecoder.
60 enum State { 61 enum State {
61 kUninitialized = 0, 62 kUninitialized = 0,
62 kDecryptorRequested, 63 kDecryptorRequested,
63 kPendingDecoderInit, 64 kPendingDecoderInit,
64 kIdle, 65 kIdle,
65 kPendingConfigChange, 66 kPendingConfigChange,
66 kPendingDemuxerRead, 67 kPendingDemuxerRead,
67 kPendingDecode, 68 kPendingDecode,
68 kWaitingForKey, 69 kWaitingForKey,
69 kDecodeFinished, 70 kDecodeFinished,
71 kStopped,
70 }; 72 };
71 73
72 // Callback for DecryptorHost::RequestDecryptor(). 74 // Callback for DecryptorHost::RequestDecryptor().
73 void SetDecryptor(Decryptor* decryptor); 75 void SetDecryptor(Decryptor* decryptor);
74 76
75 // Callback for Decryptor::InitializeAudioDecoder() during initialization. 77 // Callback for Decryptor::InitializeAudioDecoder() during initialization.
76 void FinishInitialization(bool success); 78 void FinishInitialization(bool success);
77 79
78 // Callback for Decryptor::InitializeAudioDecoder() during config change. 80 // Callback for Decryptor::InitializeAudioDecoder() during config change.
79 void FinishConfigChange(bool success); 81 void FinishConfigChange(bool success);
(...skipping 28 matching lines...) Expand all
108 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 110 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
109 base::WeakPtrFactory<DecryptingAudioDecoder> weak_factory_; 111 base::WeakPtrFactory<DecryptingAudioDecoder> weak_factory_;
110 base::WeakPtr<DecryptingAudioDecoder> weak_this_; 112 base::WeakPtr<DecryptingAudioDecoder> weak_this_;
111 113
112 State state_; 114 State state_;
113 115
114 PipelineStatusCB init_cb_; 116 PipelineStatusCB init_cb_;
115 StatisticsCB statistics_cb_; 117 StatisticsCB statistics_cb_;
116 ReadCB read_cb_; 118 ReadCB read_cb_;
117 base::Closure reset_cb_; 119 base::Closure reset_cb_;
120 base::Closure stop_cb_;
118 121
119 // Pointer to the demuxer stream that will feed us compressed buffers. 122 // Pointer to the demuxer stream that will feed us compressed buffers.
120 DemuxerStream* demuxer_stream_; 123 DemuxerStream* demuxer_stream_;
121 124
122 // Callback to request/cancel decryptor creation notification. 125 // Callback to request/cancel decryptor creation notification.
123 SetDecryptorReadyCB set_decryptor_ready_cb_; 126 SetDecryptorReadyCB set_decryptor_ready_cb_;
124 127
125 Decryptor* decryptor_; 128 Decryptor* decryptor_;
126 129
127 // The buffer returned by the demuxer that needs decrypting/decoding. 130 // The buffer returned by the demuxer that needs decrypting/decoding.
(...skipping 14 matching lines...) Expand all
142 int samples_per_second_; 145 int samples_per_second_;
143 146
144 scoped_ptr<AudioTimestampHelper> timestamp_helper_; 147 scoped_ptr<AudioTimestampHelper> timestamp_helper_;
145 148
146 DISALLOW_COPY_AND_ASSIGN(DecryptingAudioDecoder); 149 DISALLOW_COPY_AND_ASSIGN(DecryptingAudioDecoder);
147 }; 150 };
148 151
149 } // namespace media 152 } // namespace media
150 153
151 #endif // MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_ 154 #endif // MEDIA_FILTERS_DECRYPTING_AUDIO_DECODER_H_
OLDNEW
« no previous file with comments | « media/filters/audio_renderer_impl_unittest.cc ('k') | media/filters/decrypting_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698