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

Side by Side Diff: media/base/pipeline.cc

Issue 1083683003: Speculative revert by sheriff (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed an unrelated commit that had accidentally slipped in. Created 5 years, 8 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
« no previous file with comments | « media/base/pipeline.h ('k') | media/base/pipeline_unittest.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 #include "media/base/pipeline.h" 5 #include "media/base/pipeline.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 media_log_->CreateEvent(MediaLogEvent::PIPELINE_DESTROYED)); 61 media_log_->CreateEvent(MediaLogEvent::PIPELINE_DESTROYED));
62 } 62 }
63 63
64 void Pipeline::Start(Demuxer* demuxer, 64 void Pipeline::Start(Demuxer* demuxer,
65 scoped_ptr<Renderer> renderer, 65 scoped_ptr<Renderer> renderer,
66 const base::Closure& ended_cb, 66 const base::Closure& ended_cb,
67 const PipelineStatusCB& error_cb, 67 const PipelineStatusCB& error_cb,
68 const PipelineStatusCB& seek_cb, 68 const PipelineStatusCB& seek_cb,
69 const PipelineMetadataCB& metadata_cb, 69 const PipelineMetadataCB& metadata_cb,
70 const BufferingStateCB& buffering_state_cb, 70 const BufferingStateCB& buffering_state_cb,
71 const PaintCB& paint_cb,
71 const base::Closure& duration_change_cb, 72 const base::Closure& duration_change_cb,
72 const AddTextTrackCB& add_text_track_cb, 73 const AddTextTrackCB& add_text_track_cb,
73 const base::Closure& waiting_for_decryption_key_cb) { 74 const base::Closure& waiting_for_decryption_key_cb) {
74 DCHECK(!ended_cb.is_null()); 75 DCHECK(!ended_cb.is_null());
75 DCHECK(!error_cb.is_null()); 76 DCHECK(!error_cb.is_null());
76 DCHECK(!seek_cb.is_null()); 77 DCHECK(!seek_cb.is_null());
77 DCHECK(!metadata_cb.is_null()); 78 DCHECK(!metadata_cb.is_null());
78 DCHECK(!buffering_state_cb.is_null()); 79 DCHECK(!buffering_state_cb.is_null());
80 DCHECK(!paint_cb.is_null());
79 81
80 base::AutoLock auto_lock(lock_); 82 base::AutoLock auto_lock(lock_);
81 CHECK(!running_) << "Media pipeline is already running"; 83 CHECK(!running_) << "Media pipeline is already running";
82 running_ = true; 84 running_ = true;
83 85
84 demuxer_ = demuxer; 86 demuxer_ = demuxer;
85 renderer_ = renderer.Pass(); 87 renderer_ = renderer.Pass();
86 ended_cb_ = ended_cb; 88 ended_cb_ = ended_cb;
87 error_cb_ = error_cb; 89 error_cb_ = error_cb;
88 seek_cb_ = seek_cb; 90 seek_cb_ = seek_cb;
89 metadata_cb_ = metadata_cb; 91 metadata_cb_ = metadata_cb;
90 buffering_state_cb_ = buffering_state_cb; 92 buffering_state_cb_ = buffering_state_cb;
93 paint_cb_ = paint_cb;
91 duration_change_cb_ = duration_change_cb; 94 duration_change_cb_ = duration_change_cb;
92 add_text_track_cb_ = add_text_track_cb; 95 add_text_track_cb_ = add_text_track_cb;
93 waiting_for_decryption_key_cb_ = waiting_for_decryption_key_cb; 96 waiting_for_decryption_key_cb_ = waiting_for_decryption_key_cb;
94 97
95 task_runner_->PostTask( 98 task_runner_->PostTask(
96 FROM_HERE, base::Bind(&Pipeline::StartTask, weak_factory_.GetWeakPtr())); 99 FROM_HERE, base::Bind(&Pipeline::StartTask, weak_factory_.GetWeakPtr()));
97 } 100 }
98 101
99 void Pipeline::Stop(const base::Closure& stop_cb) { 102 void Pipeline::Stop(const base::Closure& stop_cb) {
100 DVLOG(2) << __FUNCTION__; 103 DVLOG(2) << __FUNCTION__;
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 OnError(PIPELINE_ERROR_COULD_NOT_RENDER); 707 OnError(PIPELINE_ERROR_COULD_NOT_RENDER);
705 return; 708 return;
706 } 709 }
707 710
708 base::WeakPtr<Pipeline> weak_this = weak_factory_.GetWeakPtr(); 711 base::WeakPtr<Pipeline> weak_this = weak_factory_.GetWeakPtr();
709 renderer_->Initialize( 712 renderer_->Initialize(
710 demuxer_, 713 demuxer_,
711 done_cb, 714 done_cb,
712 base::Bind(&Pipeline::OnUpdateStatistics, weak_this), 715 base::Bind(&Pipeline::OnUpdateStatistics, weak_this),
713 base::Bind(&Pipeline::BufferingStateChanged, weak_this), 716 base::Bind(&Pipeline::BufferingStateChanged, weak_this),
717 base::ResetAndReturn(&paint_cb_),
714 base::Bind(&Pipeline::OnRendererEnded, weak_this), 718 base::Bind(&Pipeline::OnRendererEnded, weak_this),
715 base::Bind(&Pipeline::OnError, weak_this), 719 base::Bind(&Pipeline::OnError, weak_this),
716 waiting_for_decryption_key_cb_); 720 waiting_for_decryption_key_cb_);
717 } 721 }
718 722
719 void Pipeline::ReportMetadata() { 723 void Pipeline::ReportMetadata() {
720 DCHECK(task_runner_->BelongsToCurrentThread()); 724 DCHECK(task_runner_->BelongsToCurrentThread());
721 PipelineMetadata metadata; 725 PipelineMetadata metadata;
722 metadata.timeline_offset = demuxer_->GetTimelineOffset(); 726 metadata.timeline_offset = demuxer_->GetTimelineOffset();
723 DemuxerStream* stream = demuxer_->GetStream(DemuxerStream::VIDEO); 727 DemuxerStream* stream = demuxer_->GetStream(DemuxerStream::VIDEO);
724 if (stream) { 728 if (stream) {
725 metadata.has_video = true; 729 metadata.has_video = true;
726 metadata.natural_size = stream->video_decoder_config().natural_size(); 730 metadata.natural_size = stream->video_decoder_config().natural_size();
727 metadata.video_rotation = stream->video_rotation(); 731 metadata.video_rotation = stream->video_rotation();
728 } 732 }
729 if (demuxer_->GetStream(DemuxerStream::AUDIO)) { 733 if (demuxer_->GetStream(DemuxerStream::AUDIO)) {
730 metadata.has_audio = true; 734 metadata.has_audio = true;
731 } 735 }
732 metadata_cb_.Run(metadata); 736 metadata_cb_.Run(metadata);
733 } 737 }
734 738
735 void Pipeline::BufferingStateChanged(BufferingState new_buffering_state) { 739 void Pipeline::BufferingStateChanged(BufferingState new_buffering_state) {
736 DVLOG(1) << __FUNCTION__ << "(" << new_buffering_state << ") "; 740 DVLOG(1) << __FUNCTION__ << "(" << new_buffering_state << ") ";
737 DCHECK(task_runner_->BelongsToCurrentThread()); 741 DCHECK(task_runner_->BelongsToCurrentThread());
738 buffering_state_cb_.Run(new_buffering_state); 742 buffering_state_cb_.Run(new_buffering_state);
739 } 743 }
740 744
741 } // namespace media 745 } // namespace media
OLDNEW
« no previous file with comments | « media/base/pipeline.h ('k') | media/base/pipeline_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698