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

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

Issue 6625059: Implementing preload=metadata for video (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup defer strategy, fix logic bug Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "base/callback.h" 5 #include "base/callback.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "media/base/filter_host.h" 12 #include "media/base/filter_host.h"
13 #include "media/base/limits.h" 13 #include "media/base/limits.h"
14 #include "media/base/media_switches.h" 14 #include "media/base/media_switches.h"
15 #include "media/ffmpeg/ffmpeg_common.h" 15 #include "media/ffmpeg/ffmpeg_common.h"
16 #include "media/filters/bitstream_converter.h" 16 #include "media/filters/bitstream_converter.h"
17 #include "media/filters/ffmpeg_demuxer.h" 17 #include "media/filters/ffmpeg_demuxer.h"
18 #include "media/filters/ffmpeg_glue.h" 18 #include "media/filters/ffmpeg_glue.h"
19 #include "webkit/glue/media/defer_strategy.h"
19 #include "media/filters/ffmpeg_h264_bitstream_converter.h" 20 #include "media/filters/ffmpeg_h264_bitstream_converter.h"
20 21
21 namespace media { 22 namespace media {
22 23
23 // 24 //
24 // AVPacketBuffer 25 // AVPacketBuffer
25 // 26 //
26 class AVPacketBuffer : public Buffer { 27 class AVPacketBuffer : public Buffer {
27 public: 28 public:
28 AVPacketBuffer(AVPacket* packet, const base::TimeDelta& timestamp, 29 AVPacketBuffer(AVPacket* packet, const base::TimeDelta& timestamp,
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 304
304 void FFmpegDemuxer::Seek(base::TimeDelta time, FilterCallback* callback) { 305 void FFmpegDemuxer::Seek(base::TimeDelta time, FilterCallback* callback) {
305 // TODO(hclam): by returning from this method, it is assumed that the seek 306 // TODO(hclam): by returning from this method, it is assumed that the seek
306 // operation is completed and filters behind the demuxer is good to issue 307 // operation is completed and filters behind the demuxer is good to issue
307 // more reads, but we are posting a task here, which makes the seek operation 308 // more reads, but we are posting a task here, which makes the seek operation
308 // asynchronous, should change how seek works to make it fully asynchronous. 309 // asynchronous, should change how seek works to make it fully asynchronous.
309 message_loop_->PostTask(FROM_HERE, 310 message_loop_->PostTask(FROM_HERE,
310 NewRunnableMethod(this, &FFmpegDemuxer::SeekTask, time, callback)); 311 NewRunnableMethod(this, &FFmpegDemuxer::SeekTask, time, callback));
311 } 312 }
312 313
314 void FFmpegDemuxer::SetPlaybackRate(float playback_rate) {
acolwell GONE FROM CHROMIUM 2011/03/25 04:35:28 This is necessary because we accidentally broke th
vrk (LEFT CHROMIUM) 2011/03/25 21:33:32 Sure, will do!
315 DCHECK(data_source_.get());
316 data_source_->SetPlaybackRate(playback_rate);
317 }
318
319 void FFmpegDemuxer::SetPreload(media::Preload preload) {
acolwell GONE FROM CHROMIUM 2011/03/25 04:35:28 shouldn't need media::
vrk (LEFT CHROMIUM) 2011/03/25 21:33:32 Done.
320 DCHECK(data_source_.get());
321 data_source_->SetPreload(preload);
322 }
323
313 void FFmpegDemuxer::OnAudioRendererDisabled() { 324 void FFmpegDemuxer::OnAudioRendererDisabled() {
314 message_loop_->PostTask(FROM_HERE, 325 message_loop_->PostTask(FROM_HERE,
315 NewRunnableMethod(this, &FFmpegDemuxer::DisableAudioStreamTask)); 326 NewRunnableMethod(this, &FFmpegDemuxer::DisableAudioStreamTask));
316 } 327 }
317 328
318 void FFmpegDemuxer::set_host(FilterHost* filter_host) { 329 void FFmpegDemuxer::set_host(FilterHost* filter_host) {
319 Demuxer::set_host(filter_host); 330 Demuxer::set_host(filter_host);
320 if (data_source_) 331 if (data_source_)
321 data_source_->set_host(filter_host); 332 data_source_->set_host(filter_host);
322 if (max_duration_.InMicroseconds() >= 0) 333 if (max_duration_.InMicroseconds() >= 0)
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 read_event_.Wait(); 661 read_event_.Wait();
651 return last_read_bytes_; 662 return last_read_bytes_;
652 } 663 }
653 664
654 void FFmpegDemuxer::SignalReadCompleted(size_t size) { 665 void FFmpegDemuxer::SignalReadCompleted(size_t size) {
655 last_read_bytes_ = size; 666 last_read_bytes_ = size;
656 read_event_.Signal(); 667 read_event_.Signal();
657 } 668 }
658 669
659 } // namespace media 670 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698