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

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

Issue 1143223007: media: Reland "Simplify {Audio|Video}Decoder initialization callback." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « media/filters/decoder_selector.cc ('k') | media/filters/decoder_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 18 matching lines...) Expand all
29 class DecryptingDemuxerStream; 29 class DecryptingDemuxerStream;
30 30
31 // Wraps a DemuxerStream and a list of Decoders and provides decoded 31 // Wraps a DemuxerStream and a list of Decoders and provides decoded
32 // output to its client (e.g. Audio/VideoRendererImpl). 32 // output to its client (e.g. Audio/VideoRendererImpl).
33 template<DemuxerStream::Type StreamType> 33 template<DemuxerStream::Type StreamType>
34 class MEDIA_EXPORT DecoderStream { 34 class MEDIA_EXPORT DecoderStream {
35 public: 35 public:
36 typedef DecoderStreamTraits<StreamType> StreamTraits; 36 typedef DecoderStreamTraits<StreamType> StreamTraits;
37 typedef typename StreamTraits::DecoderType Decoder; 37 typedef typename StreamTraits::DecoderType Decoder;
38 typedef typename StreamTraits::OutputType Output; 38 typedef typename StreamTraits::OutputType Output;
39 typedef typename StreamTraits::StreamInitCB InitCB;
40 typedef typename Decoder::Status DecoderStatus; 39 typedef typename Decoder::Status DecoderStatus;
41 40
42 enum Status { 41 enum Status {
43 OK, // Everything went as planned. 42 OK, // Everything went as planned.
44 ABORTED, // Read aborted due to Reset() during pending read. 43 ABORTED, // Read aborted due to Reset() during pending read.
45 DEMUXER_READ_ABORTED, // Demuxer returned aborted read. 44 DEMUXER_READ_ABORTED, // Demuxer returned aborted read.
46 DECODE_ERROR, // Decoder returned decode error. 45 DECODE_ERROR, // Decoder returned decode error.
47 }; 46 };
48 47
48 // Indicates completion of a DecoderStream initialization.
49 typedef base::Callback<void(bool success)> InitCB;
50
49 // Indicates completion of a DecoderStream read. 51 // Indicates completion of a DecoderStream read.
50 typedef base::Callback<void(Status, const scoped_refptr<Output>&)> ReadCB; 52 typedef base::Callback<void(Status, const scoped_refptr<Output>&)> ReadCB;
51 53
52 DecoderStream( 54 DecoderStream(
53 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 55 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
54 ScopedVector<Decoder> decoders, 56 ScopedVector<Decoder> decoders,
55 const scoped_refptr<MediaLog>& media_log); 57 const scoped_refptr<MediaLog>& media_log);
56 virtual ~DecoderStream(); 58 virtual ~DecoderStream();
57 59
58 // Initializes the DecoderStream and returns the initialization result 60 // Initializes the DecoderStream and returns the initialization result
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // Reads a buffer from |stream_| and returns the result via OnBufferReady(). 150 // Reads a buffer from |stream_| and returns the result via OnBufferReady().
149 void ReadFromDemuxerStream(); 151 void ReadFromDemuxerStream();
150 152
151 // Callback for DemuxerStream::Read(). 153 // Callback for DemuxerStream::Read().
152 void OnBufferReady(DemuxerStream::Status status, 154 void OnBufferReady(DemuxerStream::Status status,
153 const scoped_refptr<DecoderBuffer>& buffer); 155 const scoped_refptr<DecoderBuffer>& buffer);
154 156
155 void ReinitializeDecoder(); 157 void ReinitializeDecoder();
156 158
157 // Callback for Decoder reinitialization. 159 // Callback for Decoder reinitialization.
158 void OnDecoderReinitialized(PipelineStatus status); 160 void OnDecoderReinitialized(bool success);
159 161
160 void CompleteDecoderReinitialization(bool success); 162 void CompleteDecoderReinitialization(bool success);
161 163
162 void ResetDecoder(); 164 void ResetDecoder();
163 void OnDecoderReset(); 165 void OnDecoderReset();
164 166
165 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 167 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
166 168
167 scoped_refptr<MediaLog> media_log_; 169 scoped_refptr<MediaLog> media_log_;
168 170
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 216
215 template <> 217 template <>
216 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const; 218 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const;
217 219
218 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; 220 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream;
219 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; 221 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream;
220 222
221 } // namespace media 223 } // namespace media
222 224
223 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ 225 #endif // MEDIA_FILTERS_DECODER_STREAM_H_
OLDNEW
« no previous file with comments | « media/filters/decoder_selector.cc ('k') | media/filters/decoder_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698