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

Side by Side Diff: media/filters/video_frame_stream.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
« no previous file with comments | « media/filters/video_decoder_selector.cc ('k') | media/filters/video_frame_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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_VIDEO_FRAME_STREAM_H_ 5 #ifndef MEDIA_FILTERS_VIDEO_FRAME_STREAM_H_
6 #define MEDIA_FILTERS_VIDEO_FRAME_STREAM_H_ 6 #define MEDIA_FILTERS_VIDEO_FRAME_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"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_vector.h" 12 #include "base/memory/scoped_vector.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "media/base/decryptor.h" 14 #include "media/base/decryptor.h"
15 #include "media/base/demuxer_stream.h" 15 #include "media/base/demuxer_stream.h"
16 #include "media/base/media_export.h" 16 #include "media/base/media_export.h"
17 #include "media/base/pipeline_status.h" 17 #include "media/base/pipeline_status.h"
18 #include "media/base/video_decoder.h" 18 #include "media/base/video_decoder.h"
19 19
20 namespace base { 20 namespace base {
21 class MessageLoopProxy; 21 class SingleThreadTaskRunner;
22 } 22 }
23 23
24 namespace media { 24 namespace media {
25 25
26 class DecryptingDemuxerStream; 26 class DecryptingDemuxerStream;
27 class VideoDecoderSelector; 27 class VideoDecoderSelector;
28 28
29 // Wraps a DemuxerStream and a list of VideoDecoders and provides decoded 29 // Wraps a DemuxerStream and a list of VideoDecoders and provides decoded
30 // VideoFrames to its client (e.g. VideoRendererImpl). 30 // VideoFrames to its client (e.g. VideoRendererImpl).
31 class MEDIA_EXPORT VideoFrameStream { 31 class MEDIA_EXPORT VideoFrameStream {
32 public: 32 public:
33 // Indicates completion of VideoFrameStream initialization. 33 // Indicates completion of VideoFrameStream initialization.
34 typedef base::Callback<void(bool success, bool has_alpha)> InitCB; 34 typedef base::Callback<void(bool success, bool has_alpha)> InitCB;
35 35
36 enum Status { 36 enum Status {
37 OK, // Everything went as planned. 37 OK, // Everything went as planned.
38 ABORTED, // Read aborted due to Reset() during pending read. 38 ABORTED, // Read aborted due to Reset() during pending read.
39 DEMUXER_READ_ABORTED, // Demuxer returned aborted read. 39 DEMUXER_READ_ABORTED, // Demuxer returned aborted read.
40 DECODE_ERROR, // Decoder returned decode error. 40 DECODE_ERROR, // Decoder returned decode error.
41 DECRYPT_ERROR // Decoder returned decrypt error. 41 DECRYPT_ERROR // Decoder returned decrypt error.
42 }; 42 };
43 43
44 // Indicates completion of a VideoFrameStream read. 44 // Indicates completion of a VideoFrameStream read.
45 typedef base::Callback<void(Status, const scoped_refptr<VideoFrame>&)> ReadCB; 45 typedef base::Callback<void(Status, const scoped_refptr<VideoFrame>&)> ReadCB;
46 46
47 VideoFrameStream(const scoped_refptr<base::MessageLoopProxy>& message_loop, 47 VideoFrameStream(
48 ScopedVector<VideoDecoder> decoders, 48 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
49 const SetDecryptorReadyCB& set_decryptor_ready_cb); 49 ScopedVector<VideoDecoder> decoders,
50 const SetDecryptorReadyCB& set_decryptor_ready_cb);
50 virtual ~VideoFrameStream(); 51 virtual ~VideoFrameStream();
51 52
52 // Initializes the VideoFrameStream and returns the initialization result 53 // Initializes the VideoFrameStream and returns the initialization result
53 // through |init_cb|. Note that |init_cb| is always called asynchronously. 54 // through |init_cb|. Note that |init_cb| is always called asynchronously.
54 void Initialize(DemuxerStream* stream, 55 void Initialize(DemuxerStream* stream,
55 const StatisticsCB& statistics_cb, 56 const StatisticsCB& statistics_cb,
56 const InitCB& init_cb); 57 const InitCB& init_cb);
57 58
58 // Reads a decoded VideoFrame and returns it via the |read_cb|. Note that 59 // Reads a decoded VideoFrame and returns it via the |read_cb|. Note that
59 // |read_cb| is always called asynchronously. This method should only be 60 // |read_cb| is always called asynchronously. This method should only be
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 128
128 // Callback for VideoDecoder reinitialization. 129 // Callback for VideoDecoder reinitialization.
129 void OnDecoderReinitialized(PipelineStatus status); 130 void OnDecoderReinitialized(PipelineStatus status);
130 131
131 void ResetDecoder(); 132 void ResetDecoder();
132 void OnDecoderReset(); 133 void OnDecoderReset();
133 134
134 void StopDecoder(); 135 void StopDecoder();
135 void OnDecoderStopped(); 136 void OnDecoderStopped();
136 137
137 scoped_refptr<base::MessageLoopProxy> message_loop_; 138 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
138 base::WeakPtrFactory<VideoFrameStream> weak_factory_; 139 base::WeakPtrFactory<VideoFrameStream> weak_factory_;
139 140
140 State state_; 141 State state_;
141 142
142 StatisticsCB statistics_cb_; 143 StatisticsCB statistics_cb_;
143 InitCB init_cb_; 144 InitCB init_cb_;
144 145
145 ReadCB read_cb_; 146 ReadCB read_cb_;
146 base::Closure reset_cb_; 147 base::Closure reset_cb_;
147 base::Closure stop_cb_; 148 base::Closure stop_cb_;
148 149
149 DemuxerStream* stream_; 150 DemuxerStream* stream_;
150 151
151 scoped_ptr<VideoDecoderSelector> decoder_selector_; 152 scoped_ptr<VideoDecoderSelector> decoder_selector_;
152 153
153 // These two will be set by VideoDecoderSelector::SelectVideoDecoder(). 154 // These two will be set by VideoDecoderSelector::SelectVideoDecoder().
154 scoped_ptr<VideoDecoder> decoder_; 155 scoped_ptr<VideoDecoder> decoder_;
155 scoped_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream_; 156 scoped_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream_;
156 157
157 DISALLOW_COPY_AND_ASSIGN(VideoFrameStream); 158 DISALLOW_COPY_AND_ASSIGN(VideoFrameStream);
158 }; 159 };
159 160
160 } // namespace media 161 } // namespace media
161 162
162 #endif // MEDIA_FILTERS_VIDEO_FRAME_STREAM_H_ 163 #endif // MEDIA_FILTERS_VIDEO_FRAME_STREAM_H_
OLDNEW
« no previous file with comments | « media/filters/video_decoder_selector.cc ('k') | media/filters/video_frame_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698