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

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

Issue 2710133003: Replace FFmpegDemuxer thread per element with base::TaskScheduler. (Closed)
Patch Set: Use base::TaskScheduler. Created 3 years, 10 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // Called after the streams have been collected from the media, to allow 289 // Called after the streams have been collected from the media, to allow
288 // the text renderer to bind each text stream to the cue rendering engine. 290 // the text renderer to bind each text stream to the cue rendering engine.
289 void AddTextStreams(); 291 void AddTextStreams();
290 292
291 void SetLiveness(DemuxerStream::Liveness liveness); 293 void SetLiveness(DemuxerStream::Liveness liveness);
292 294
293 DemuxerHost* host_; 295 DemuxerHost* host_;
294 296
295 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 297 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
296 298
297 // Thread on which all blocking FFmpeg operations are executed. 299 // Blocking pool on which all blocking FFmpeg operations are executed.
gab 2017/02/23 21:37:10 nit: A SequencedTaskRunner isn't a "pool", it's a
DaleCurtis 2017/02/23 23:07:06 We definitely want sequence here. Updated the comm
298 base::Thread blocking_thread_; 300 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
301
302 // Indicates if Stop() has been called.
303 bool stopped_;
299 304
300 // Tracks if there's an outstanding av_read_frame() operation. 305 // Tracks if there's an outstanding av_read_frame() operation.
301 // 306 //
302 // TODO(scherkus): Allow more than one read in flight for higher read 307 // TODO(scherkus): Allow more than one read in flight for higher read
303 // throughput using demuxer_bench to verify improvements. 308 // throughput using demuxer_bench to verify improvements.
304 bool pending_read_; 309 bool pending_read_;
305 310
306 // Tracks if there's an outstanding av_seek_frame() operation. Used to discard 311 // Tracks if there's an outstanding av_seek_frame() operation. Used to discard
307 // results of pre-seek av_read_frame() operations. 312 // results of pre-seek av_read_frame() operations.
308 PipelineStatusCB pending_seek_cb_; 313 PipelineStatusCB pending_seek_cb_;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 base::WeakPtr<FFmpegDemuxer> weak_this_; 375 base::WeakPtr<FFmpegDemuxer> weak_this_;
371 base::WeakPtrFactory<FFmpegDemuxer> cancel_pending_seek_factory_; 376 base::WeakPtrFactory<FFmpegDemuxer> cancel_pending_seek_factory_;
372 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_; 377 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_;
373 378
374 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); 379 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer);
375 }; 380 };
376 381
377 } // namespace media 382 } // namespace media
378 383
379 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ 384 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698