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

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

Issue 239893002: Allow multiple concurrent Decode() requests in VideoDecoder interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_DECODER_STREAM_H_ 5 #ifndef MEDIA_FILTERS_DECODER_STREAM_H_
6 #define MEDIA_FILTERS_DECODER_STREAM_H_ 6 #define MEDIA_FILTERS_DECODER_STREAM_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // it is stopped. This method can be called at any time but not during another 80 // it is stopped. This method can be called at any time but not during another
81 // pending Stop(). 81 // pending Stop().
82 void Stop(const base::Closure& closure); 82 void Stop(const base::Closure& closure);
83 83
84 // Returns true if the decoder currently has the ability to decode and return 84 // Returns true if the decoder currently has the ability to decode and return
85 // an Output. 85 // an Output.
86 // TODO(rileya): Remove the need for this by refactoring Decoder queueing 86 // TODO(rileya): Remove the need for this by refactoring Decoder queueing
87 // behavior. 87 // behavior.
88 bool CanReadWithoutStalling() const; 88 bool CanReadWithoutStalling() const;
89 89
90 // Returns true if one more decode request can be submitted to the decoder.
91 bool CanDecodeMore() const;
92
90 // Allows callers to register for notification of splice buffers from the 93 // Allows callers to register for notification of splice buffers from the
91 // demuxer. I.e., DecoderBuffer::splice_timestamp() is not kNoTimestamp(). 94 // demuxer. I.e., DecoderBuffer::splice_timestamp() is not kNoTimestamp().
92 // 95 //
93 // The observer will be notified of all buffers with a splice_timestamp() and 96 // The observer will be notified of all buffers with a splice_timestamp() and
94 // the first buffer after which has a splice_timestamp() of kNoTimestamp(). 97 // the first buffer after which has a splice_timestamp() of kNoTimestamp().
95 typedef base::Callback<void(base::TimeDelta)> SpliceObserverCB; 98 typedef base::Callback<void(base::TimeDelta)> SpliceObserverCB;
96 void set_splice_observer(const SpliceObserverCB& splice_observer) { 99 void set_splice_observer(const SpliceObserverCB& splice_observer) {
97 splice_observer_cb_ = splice_observer; 100 splice_observer_cb_ = splice_observer;
98 } 101 }
99 102
(...skipping 22 matching lines...) Expand all
122 // |decrypting_demuxer_stream| was also populated if a DecryptingDemuxerStream 125 // |decrypting_demuxer_stream| was also populated if a DecryptingDemuxerStream
123 // is created to help decrypt the encrypted stream. 126 // is created to help decrypt the encrypted stream.
124 void OnDecoderSelected( 127 void OnDecoderSelected(
125 scoped_ptr<Decoder> selected_decoder, 128 scoped_ptr<Decoder> selected_decoder,
126 scoped_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream); 129 scoped_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream);
127 130
128 // Satisfy pending |read_cb_| with |status| and |output|. 131 // Satisfy pending |read_cb_| with |status| and |output|.
129 void SatisfyRead(Status status, 132 void SatisfyRead(Status status,
130 const scoped_refptr<Output>& output); 133 const scoped_refptr<Output>& output);
131 134
132 // Abort pending |read_cb_|.
133 void AbortRead();
134
135 // Decodes |buffer| and returns the result via OnDecodeOutputReady(). 135 // Decodes |buffer| and returns the result via OnDecodeOutputReady().
136 void Decode(const scoped_refptr<DecoderBuffer>& buffer); 136 void Decode(const scoped_refptr<DecoderBuffer>& buffer);
137 137
138 // Flushes the decoder with an EOS buffer to retrieve internally buffered 138 // Flushes the decoder with an EOS buffer to retrieve internally buffered
139 // decoder output. 139 // decoder output.
140 void FlushDecoder(); 140 void FlushDecoder();
141 141
142 // Callback for Decoder::Decode(). 142 // Callback for Decoder::Decode().
143 void OnDecodeOutputReady(int buffer_size, 143 void OnDecodeOutputReady(int buffer_size,
144 DecoderStatus status, 144 DecoderStatus status,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 scoped_ptr<Decoder> decoder_; 180 scoped_ptr<Decoder> decoder_;
181 scoped_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream_; 181 scoped_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream_;
182 182
183 SpliceObserverCB splice_observer_cb_; 183 SpliceObserverCB splice_observer_cb_;
184 ConfigChangeObserverCB config_change_observer_cb_; 184 ConfigChangeObserverCB config_change_observer_cb_;
185 185
186 // If a splice_timestamp() has been seen, this is true until a 186 // If a splice_timestamp() has been seen, this is true until a
187 // splice_timestamp() of kNoTimestamp() is encountered. 187 // splice_timestamp() of kNoTimestamp() is encountered.
188 bool active_splice_; 188 bool active_splice_;
189 189
190 // Decoded buffers that haven't been read yet. Used when the decoder supports
191 // parallel decoding.
192 std::list<scoped_refptr<Output> > ready_outputs_;
193
194 // Number of outstanding decode requests sent to the |decoder_|.
195 int pending_decode_requests_;
196
190 // NOTE: Weak pointers must be invalidated before all other member variables. 197 // NOTE: Weak pointers must be invalidated before all other member variables.
191 base::WeakPtrFactory<DecoderStream<StreamType> > weak_factory_; 198 base::WeakPtrFactory<DecoderStream<StreamType> > weak_factory_;
192 199
193 // This is required so the VideoFrameStream can access private members in 200 // This is required so the VideoFrameStream can access private members in
194 // FinishInitialization() and ReportStatistics(). 201 // FinishInitialization() and ReportStatistics().
195 DISALLOW_IMPLICIT_CONSTRUCTORS(DecoderStream); 202 DISALLOW_IMPLICIT_CONSTRUCTORS(DecoderStream);
196 }; 203 };
197 204
198 template <> 205 template <>
199 bool DecoderStream<DemuxerStream::AUDIO>::CanReadWithoutStalling() const; 206 bool DecoderStream<DemuxerStream::AUDIO>::CanReadWithoutStalling() const;
200 207
208 template <>
209 bool DecoderStream<DemuxerStream::AUDIO>::CanDecodeMore() const;
210
201 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; 211 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream;
202 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; 212 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream;
203 213
204 } // namespace media 214 } // namespace media
205 215
206 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ 216 #endif // MEDIA_FILTERS_DECODER_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698