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

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

Issue 2710133003: Replace FFmpegDemuxer thread per element with base::TaskScheduler. (Closed)
Patch Set: Give WeakPtr to URLProtocol. Created 3 years, 9 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 // 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 14 matching lines...) Expand all
25 #include <stddef.h> 25 #include <stddef.h>
26 #include <stdint.h> 26 #include <stdint.h>
27 27
28 #include <memory> 28 #include <memory>
29 #include <string> 29 #include <string>
30 #include <utility> 30 #include <utility>
31 #include <vector> 31 #include <vector>
32 32
33 #include "base/callback.h" 33 #include "base/callback.h"
34 #include "base/macros.h" 34 #include "base/macros.h"
35 #include "base/threading/thread.h" 35 #include "base/memory/weak_ptr.h"
36 #include "base/sequenced_task_runner.h"
37 #include "base/single_thread_task_runner.h"
36 #include "media/base/audio_decoder_config.h" 38 #include "media/base/audio_decoder_config.h"
37 #include "media/base/decoder_buffer.h" 39 #include "media/base/decoder_buffer.h"
38 #include "media/base/decoder_buffer_queue.h" 40 #include "media/base/decoder_buffer_queue.h"
39 #include "media/base/demuxer.h" 41 #include "media/base/demuxer.h"
40 #include "media/base/pipeline_status.h" 42 #include "media/base/pipeline_status.h"
41 #include "media/base/text_track_config.h" 43 #include "media/base/text_track_config.h"
42 #include "media/base/video_decoder_config.h" 44 #include "media/base/video_decoder_config.h"
43 #include "media/ffmpeg/ffmpeg_deleters.h" 45 #include "media/ffmpeg/ffmpeg_deleters.h"
44 #include "media/filters/blocking_url_protocol.h" 46 #include "media/filters/blocking_url_protocol.h"
45 #include "media/media_features.h" 47 #include "media/media_features.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 // Called after the streams have been collected from the media, to allow 290 // Called after the streams have been collected from the media, to allow
289 // the text renderer to bind each text stream to the cue rendering engine. 291 // the text renderer to bind each text stream to the cue rendering engine.
290 void AddTextStreams(); 292 void AddTextStreams();
291 293
292 void SetLiveness(DemuxerStream::Liveness liveness); 294 void SetLiveness(DemuxerStream::Liveness liveness);
293 295
294 DemuxerHost* host_; 296 DemuxerHost* host_;
295 297
296 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 298 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
297 299
298 // Thread on which all blocking FFmpeg operations are executed. 300 // Task runner on which all blocking FFmpeg operations are executed; retrieved
299 base::Thread blocking_thread_; 301 // from base::TaskScheduler.
302 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
303
304 // Indicates if Stop() has been called.
305 bool stopped_;
300 306
301 // Tracks if there's an outstanding av_read_frame() operation. 307 // Tracks if there's an outstanding av_read_frame() operation.
302 // 308 //
303 // TODO(scherkus): Allow more than one read in flight for higher read 309 // TODO(scherkus): Allow more than one read in flight for higher read
304 // throughput using demuxer_bench to verify improvements. 310 // throughput using demuxer_bench to verify improvements.
305 bool pending_read_; 311 bool pending_read_;
306 312
307 // Tracks if there's an outstanding av_seek_frame() operation. Used to discard 313 // Tracks if there's an outstanding av_seek_frame() operation. Used to discard
308 // results of pre-seek av_read_frame() operations. 314 // results of pre-seek av_read_frame() operations.
309 PipelineStatusCB pending_seek_cb_; 315 PipelineStatusCB pending_seek_cb_;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 base::WeakPtr<FFmpegDemuxer> weak_this_; 377 base::WeakPtr<FFmpegDemuxer> weak_this_;
372 base::WeakPtrFactory<FFmpegDemuxer> cancel_pending_seek_factory_; 378 base::WeakPtrFactory<FFmpegDemuxer> cancel_pending_seek_factory_;
373 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_; 379 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_;
374 380
375 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); 381 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer);
376 }; 382 };
377 383
378 } // namespace media 384 } // namespace media
379 385
380 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ 386 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698