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

Side by Side Diff: media/filters/ffmpeg_demuxer.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/ffmpeg_audio_decoder.cc ('k') | media/filters/ffmpeg_demuxer.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) 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 // Implements the Demuxer interface using FFmpeg's libavformat. At this time 5 // Implements the Demuxer interface using FFmpeg's libavformat. At this time
6 // will support demuxing any audio/video format thrown at it. The streams 6 // will support demuxing any audio/video format thrown at it. The streams
7 // output mime types audio/x-ffmpeg and video/x-ffmpeg and include an integer 7 // output mime types audio/x-ffmpeg and video/x-ffmpeg and include an integer
8 // key FFmpegCodecID which contains the CodecID enumeration value. The CodecIDs 8 // key FFmpegCodecID which contains the CodecID enumeration value. The CodecIDs
9 // can be used to create and initialize the corresponding FFmpeg decoder. 9 // can be used to create and initialize the corresponding FFmpeg decoder.
10 // 10 //
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 // Runs |read_cb_| if present with the front of |buffer_queue_|, calling 106 // Runs |read_cb_| if present with the front of |buffer_queue_|, calling
107 // NotifyCapacityAvailable() if capacity is still available. 107 // NotifyCapacityAvailable() if capacity is still available.
108 void SatisfyPendingRead(); 108 void SatisfyPendingRead();
109 109
110 // Converts an FFmpeg stream timestamp into a base::TimeDelta. 110 // Converts an FFmpeg stream timestamp into a base::TimeDelta.
111 static base::TimeDelta ConvertStreamTimestamp(const AVRational& time_base, 111 static base::TimeDelta ConvertStreamTimestamp(const AVRational& time_base,
112 int64 timestamp); 112 int64 timestamp);
113 113
114 FFmpegDemuxer* demuxer_; 114 FFmpegDemuxer* demuxer_;
115 scoped_refptr<base::MessageLoopProxy> message_loop_; 115 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
116 AVStream* stream_; 116 AVStream* stream_;
117 AudioDecoderConfig audio_config_; 117 AudioDecoderConfig audio_config_;
118 VideoDecoderConfig video_config_; 118 VideoDecoderConfig video_config_;
119 Type type_; 119 Type type_;
120 base::TimeDelta duration_; 120 base::TimeDelta duration_;
121 bool end_of_stream_; 121 bool end_of_stream_;
122 base::TimeDelta last_packet_timestamp_; 122 base::TimeDelta last_packet_timestamp_;
123 Ranges<base::TimeDelta> buffered_ranges_; 123 Ranges<base::TimeDelta> buffered_ranges_;
124 124
125 DecoderBufferQueue buffer_queue_; 125 DecoderBufferQueue buffer_queue_;
126 ReadCB read_cb_; 126 ReadCB read_cb_;
127 127
128 scoped_ptr<FFmpegH264ToAnnexBBitstreamConverter> bitstream_converter_; 128 scoped_ptr<FFmpegH264ToAnnexBBitstreamConverter> bitstream_converter_;
129 bool bitstream_converter_enabled_; 129 bool bitstream_converter_enabled_;
130 130
131 std::string encryption_key_id_; 131 std::string encryption_key_id_;
132 132
133 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerStream); 133 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerStream);
134 }; 134 };
135 135
136 class MEDIA_EXPORT FFmpegDemuxer : public Demuxer { 136 class MEDIA_EXPORT FFmpegDemuxer : public Demuxer {
137 public: 137 public:
138 FFmpegDemuxer(const scoped_refptr<base::MessageLoopProxy>& message_loop, 138 FFmpegDemuxer(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
139 DataSource* data_source, 139 DataSource* data_source,
140 const NeedKeyCB& need_key_cb, 140 const NeedKeyCB& need_key_cb,
141 const scoped_refptr<MediaLog>& media_log); 141 const scoped_refptr<MediaLog>& media_log);
142 virtual ~FFmpegDemuxer(); 142 virtual ~FFmpegDemuxer();
143 143
144 // Demuxer implementation. 144 // Demuxer implementation.
145 virtual void Initialize(DemuxerHost* host, 145 virtual void Initialize(DemuxerHost* host,
146 const PipelineStatusCB& status_cb, 146 const PipelineStatusCB& status_cb,
147 bool enable_text_tracks) OVERRIDE; 147 bool enable_text_tracks) OVERRIDE;
148 virtual void Stop(const base::Closure& callback) OVERRIDE; 148 virtual void Stop(const base::Closure& callback) OVERRIDE;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // Returns the stream from |streams_| that matches |type| as an 191 // Returns the stream from |streams_| that matches |type| as an
192 // FFmpegDemuxerStream. 192 // FFmpegDemuxerStream.
193 FFmpegDemuxerStream* GetFFmpegStream(DemuxerStream::Type type) const; 193 FFmpegDemuxerStream* GetFFmpegStream(DemuxerStream::Type type) const;
194 194
195 // Called after the streams have been collected from the media, to allow 195 // Called after the streams have been collected from the media, to allow
196 // the text renderer to bind each text stream to the cue rendering engine. 196 // the text renderer to bind each text stream to the cue rendering engine.
197 void AddTextStreams(); 197 void AddTextStreams();
198 198
199 DemuxerHost* host_; 199 DemuxerHost* host_;
200 200
201 scoped_refptr<base::MessageLoopProxy> message_loop_; 201 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
202 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_; 202 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_;
203 base::WeakPtr<FFmpegDemuxer> weak_this_; 203 base::WeakPtr<FFmpegDemuxer> weak_this_;
204 204
205 // Thread on which all blocking FFmpeg operations are executed. 205 // Thread on which all blocking FFmpeg operations are executed.
206 base::Thread blocking_thread_; 206 base::Thread blocking_thread_;
207 207
208 // Tracks if there's an outstanding av_read_frame() operation. 208 // Tracks if there's an outstanding av_read_frame() operation.
209 // 209 //
210 // TODO(scherkus): Allow more than one read in flight for higher read 210 // TODO(scherkus): Allow more than one read in flight for higher read
211 // throughput using demuxer_bench to verify improvements. 211 // throughput using demuxer_bench to verify improvements.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 scoped_ptr<FFmpegGlue> glue_; 257 scoped_ptr<FFmpegGlue> glue_;
258 258
259 const NeedKeyCB need_key_cb_; 259 const NeedKeyCB need_key_cb_;
260 260
261 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); 261 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer);
262 }; 262 };
263 263
264 } // namespace media 264 } // namespace media
265 265
266 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ 266 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_audio_decoder.cc ('k') | media/filters/ffmpeg_demuxer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698