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

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

Issue 1094553002: Revert "Speculative revert by sheriff" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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,
72 const base::Closure& duration_change_cb, 71 const base::Closure& duration_change_cb,
73 const AddTextTrackCB& add_text_track_cb, 72 const AddTextTrackCB& add_text_track_cb,
74 const base::Closure& waiting_for_decryption_key_cb) { 73 const base::Closure& waiting_for_decryption_key_cb) {
75 DCHECK(!ended_cb.is_null()); 74 DCHECK(!ended_cb.is_null());
76 DCHECK(!error_cb.is_null()); 75 DCHECK(!error_cb.is_null());
77 DCHECK(!seek_cb.is_null()); 76 DCHECK(!seek_cb.is_null());
78 DCHECK(!metadata_cb.is_null()); 77 DCHECK(!metadata_cb.is_null());
79 DCHECK(!buffering_state_cb.is_null()); 78 DCHECK(!buffering_state_cb.is_null());
80 DCHECK(!paint_cb.is_null());
81 79
82 base::AutoLock auto_lock(lock_); 80 base::AutoLock auto_lock(lock_);
83 CHECK(!running_) << "Media pipeline is already running"; 81 CHECK(!running_) << "Media pipeline is already running";
84 running_ = true; 82 running_ = true;
85 83
86 demuxer_ = demuxer; 84 demuxer_ = demuxer;
87 renderer_ = renderer.Pass(); 85 renderer_ = renderer.Pass();
88 ended_cb_ = ended_cb; 86 ended_cb_ = ended_cb;
89 error_cb_ = error_cb; 87 error_cb_ = error_cb;
90 seek_cb_ = seek_cb; 88 seek_cb_ = seek_cb;
91 metadata_cb_ = metadata_cb; 89 metadata_cb_ = metadata_cb;
92 buffering_state_cb_ = buffering_state_cb; 90 buffering_state_cb_ = buffering_state_cb;
93 paint_cb_ = paint_cb;
94 duration_change_cb_ = duration_change_cb; 91 duration_change_cb_ = duration_change_cb;
95 add_text_track_cb_ = add_text_track_cb; 92 add_text_track_cb_ = add_text_track_cb;
96 waiting_for_decryption_key_cb_ = waiting_for_decryption_key_cb; 93 waiting_for_decryption_key_cb_ = waiting_for_decryption_key_cb;
97 94
98 task_runner_->PostTask( 95 task_runner_->PostTask(
99 FROM_HERE, base::Bind(&Pipeline::StartTask, weak_factory_.GetWeakPtr())); 96 FROM_HERE, base::Bind(&Pipeline::StartTask, weak_factory_.GetWeakPtr()));
100 } 97 }
101 98
102 void Pipeline::Stop(const base::Closure& stop_cb) { 99 void Pipeline::Stop(const base::Closure& stop_cb) {
103 DVLOG(2) << __FUNCTION__; 100 DVLOG(2) << __FUNCTION__;
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 OnError(PIPELINE_ERROR_COULD_NOT_RENDER); 704 OnError(PIPELINE_ERROR_COULD_NOT_RENDER);
708 return; 705 return;
709 } 706 }
710 707
711 base::WeakPtr<Pipeline> weak_this = weak_factory_.GetWeakPtr(); 708 base::WeakPtr<Pipeline> weak_this = weak_factory_.GetWeakPtr();
712 renderer_->Initialize( 709 renderer_->Initialize(
713 demuxer_, 710 demuxer_,
714 done_cb, 711 done_cb,
715 base::Bind(&Pipeline::OnUpdateStatistics, weak_this), 712 base::Bind(&Pipeline::OnUpdateStatistics, weak_this),
716 base::Bind(&Pipeline::BufferingStateChanged, weak_this), 713 base::Bind(&Pipeline::BufferingStateChanged, weak_this),
717 base::ResetAndReturn(&paint_cb_),
718 base::Bind(&Pipeline::OnRendererEnded, weak_this), 714 base::Bind(&Pipeline::OnRendererEnded, weak_this),
719 base::Bind(&Pipeline::OnError, weak_this), 715 base::Bind(&Pipeline::OnError, weak_this),
720 waiting_for_decryption_key_cb_); 716 waiting_for_decryption_key_cb_);
721 } 717 }
722 718
723 void Pipeline::ReportMetadata() { 719 void Pipeline::ReportMetadata() {
724 DCHECK(task_runner_->BelongsToCurrentThread()); 720 DCHECK(task_runner_->BelongsToCurrentThread());
725 PipelineMetadata metadata; 721 PipelineMetadata metadata;
726 metadata.timeline_offset = demuxer_->GetTimelineOffset(); 722 metadata.timeline_offset = demuxer_->GetTimelineOffset();
727 DemuxerStream* stream = demuxer_->GetStream(DemuxerStream::VIDEO); 723 DemuxerStream* stream = demuxer_->GetStream(DemuxerStream::VIDEO);
728 if (stream) { 724 if (stream) {
729 metadata.has_video = true; 725 metadata.has_video = true;
730 metadata.natural_size = stream->video_decoder_config().natural_size(); 726 metadata.natural_size = stream->video_decoder_config().natural_size();
731 metadata.video_rotation = stream->video_rotation(); 727 metadata.video_rotation = stream->video_rotation();
732 } 728 }
733 if (demuxer_->GetStream(DemuxerStream::AUDIO)) { 729 if (demuxer_->GetStream(DemuxerStream::AUDIO)) {
734 metadata.has_audio = true; 730 metadata.has_audio = true;
735 } 731 }
736 metadata_cb_.Run(metadata); 732 metadata_cb_.Run(metadata);
737 } 733 }
738 734
739 void Pipeline::BufferingStateChanged(BufferingState new_buffering_state) { 735 void Pipeline::BufferingStateChanged(BufferingState new_buffering_state) {
740 DVLOG(1) << __FUNCTION__ << "(" << new_buffering_state << ") "; 736 DVLOG(1) << __FUNCTION__ << "(" << new_buffering_state << ") ";
741 DCHECK(task_runner_->BelongsToCurrentThread()); 737 DCHECK(task_runner_->BelongsToCurrentThread());
742 buffering_state_cb_.Run(new_buffering_state); 738 buffering_state_cb_.Run(new_buffering_state);
743 } 739 }
744 740
745 } // namespace media 741 } // 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