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

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

Issue 7193001: Move rtc_video_decoder* from media/filter/ to content/renderer/media/. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 6 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 // TODO(scherkus): clean up PipelineImpl... too many crazy function names, 5 // TODO(scherkus): clean up PipelineImpl... too many crazy function names,
6 // potential deadlocks, etc... 6 // potential deadlocks, etc...
7 7
8 #include "media/base/pipeline_impl.h" 8 #include "media/base/pipeline_impl.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/stl_util-inl.h" 15 #include "base/stl_util-inl.h"
16 #include "base/synchronization/condition_variable.h" 16 #include "base/synchronization/condition_variable.h"
17 #include "media/filters/rtc_video_decoder.h"
18 #include "media/base/clock.h" 17 #include "media/base/clock.h"
19 #include "media/base/filter_collection.h" 18 #include "media/base/filter_collection.h"
20 #include "media/base/media_format.h" 19 #include "media/base/media_format.h"
21 20
22 namespace media { 21 namespace media {
23 22
24 PipelineStatusNotification::PipelineStatusNotification() 23 PipelineStatusNotification::PipelineStatusNotification()
25 : cv_(&lock_), status_(PIPELINE_OK), notified_(false) { 24 : cv_(&lock_), status_(PIPELINE_OK), notified_(false) {
26 callback_.reset(NewCallback(this, &PipelineStatusNotification::Notify)); 25 callback_.reset(NewCallback(this, &PipelineStatusNotification::Notify));
27 } 26 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 DCHECK(!IsRunning()) 82 DCHECK(!IsRunning())
84 << "Init() should be called before the pipeline has started"; 83 << "Init() should be called before the pipeline has started";
85 ended_callback_.reset(ended_callback); 84 ended_callback_.reset(ended_callback);
86 error_callback_.reset(error_callback); 85 error_callback_.reset(error_callback);
87 network_callback_.reset(network_callback); 86 network_callback_.reset(network_callback);
88 } 87 }
89 88
90 // Creates the PipelineInternal and calls it's start method. 89 // Creates the PipelineInternal and calls it's start method.
91 bool PipelineImpl::Start(FilterCollection* collection, 90 bool PipelineImpl::Start(FilterCollection* collection,
92 const std::string& url, 91 const std::string& url,
93 PipelineStatusCallback* start_callback) { 92 PipelineStatusCallback* start_callback,
93 bool raw_video) {
94 base::AutoLock auto_lock(lock_); 94 base::AutoLock auto_lock(lock_);
95 scoped_ptr<PipelineStatusCallback> callback(start_callback); 95 scoped_ptr<PipelineStatusCallback> callback(start_callback);
96 scoped_ptr<FilterCollection> filter_collection(collection); 96 scoped_ptr<FilterCollection> filter_collection(collection);
97 97
98 if (running_) { 98 if (running_) {
99 VLOG(1) << "Media pipeline is already running"; 99 VLOG(1) << "Media pipeline is already running";
100 return false; 100 return false;
101 } 101 }
102 102
103 if (collection->IsEmpty()) { 103 if (collection->IsEmpty()) {
104 return false; 104 return false;
105 } 105 }
106 106
107 // Kick off initialization! 107 // Kick off initialization!
108 running_ = true; 108 running_ = true;
109 message_loop_->PostTask( 109 message_loop_->PostTask(
110 FROM_HERE, 110 FROM_HERE,
111 NewRunnableMethod(this, 111 NewRunnableMethod(this,
112 &PipelineImpl::StartTask, 112 &PipelineImpl::StartTask,
113 filter_collection.release(), 113 filter_collection.release(),
114 url, 114 url,
115 callback.release())); 115 callback.release(),
116 raw_video));
116 return true; 117 return true;
117 } 118 }
118 119
119 void PipelineImpl::Stop(PipelineStatusCallback* stop_callback) { 120 void PipelineImpl::Stop(PipelineStatusCallback* stop_callback) {
120 base::AutoLock auto_lock(lock_); 121 base::AutoLock auto_lock(lock_);
121 scoped_ptr<PipelineStatusCallback> callback(stop_callback); 122 scoped_ptr<PipelineStatusCallback> callback(stop_callback);
122 if (!running_) { 123 if (!running_) {
123 VLOG(1) << "Media pipeline has already stopped"; 124 VLOG(1) << "Media pipeline has already stopped";
124 return; 125 return;
125 } 126 }
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 void PipelineImpl::OnUpdateStatistics(const PipelineStatistics& stats) { 599 void PipelineImpl::OnUpdateStatistics(const PipelineStatistics& stats) {
599 base::AutoLock auto_lock(lock_); 600 base::AutoLock auto_lock(lock_);
600 statistics_.audio_bytes_decoded += stats.audio_bytes_decoded; 601 statistics_.audio_bytes_decoded += stats.audio_bytes_decoded;
601 statistics_.video_bytes_decoded += stats.video_bytes_decoded; 602 statistics_.video_bytes_decoded += stats.video_bytes_decoded;
602 statistics_.video_frames_decoded += stats.video_frames_decoded; 603 statistics_.video_frames_decoded += stats.video_frames_decoded;
603 statistics_.video_frames_dropped += stats.video_frames_dropped; 604 statistics_.video_frames_dropped += stats.video_frames_dropped;
604 } 605 }
605 606
606 void PipelineImpl::StartTask(FilterCollection* filter_collection, 607 void PipelineImpl::StartTask(FilterCollection* filter_collection,
607 const std::string& url, 608 const std::string& url,
608 PipelineStatusCallback* start_callback) { 609 PipelineStatusCallback* start_callback,
610 bool raw_video) {
609 DCHECK_EQ(MessageLoop::current(), message_loop_); 611 DCHECK_EQ(MessageLoop::current(), message_loop_);
610 DCHECK_EQ(kCreated, state_); 612 DCHECK_EQ(kCreated, state_);
611 filter_collection_.reset(filter_collection); 613 filter_collection_.reset(filter_collection);
612 url_ = url; 614 url_ = url;
613 seek_callback_.reset(start_callback); 615 seek_callback_.reset(start_callback);
614 616
615 // Kick off initialization. 617 // Kick off initialization.
616 pipeline_init_state_.reset(new PipelineInitState()); 618 pipeline_init_state_.reset(new PipelineInitState());
617 pipeline_init_state_->composite_ = new CompositeFilter(message_loop_); 619 pipeline_init_state_->composite_ = new CompositeFilter(message_loop_);
618 pipeline_init_state_->composite_->set_host(this); 620 pipeline_init_state_->composite_->set_host(this);
619 621
620 if (RTCVideoDecoder::IsUrlSupported(url)) { 622 if (raw_video) {
scherkus (not reviewing) 2011/06/17 00:31:46 this raw_video thing is kind of hacky.... can we
acolwell GONE FROM CHROMIUM 2011/06/24 17:11:27 I agree. I think we could put a kRawVideoScheme st
Ronghua 2011/06/24 21:08:51 Done.
Ronghua 2011/06/24 21:08:51 Done.
621 set_state(kInitVideoDecoder); 623 set_state(kInitVideoDecoder);
622 InitializeVideoDecoder(NULL); 624 InitializeVideoDecoder(NULL);
623 } else { 625 } else {
624 set_state(kInitDemuxer); 626 set_state(kInitDemuxer);
625 InitializeDemuxer(); 627 InitializeDemuxer();
626 } 628 }
627 } 629 }
628 630
629 // Main initialization method called on the pipeline thread. This code attempts 631 // Main initialization method called on the pipeline thread. This code attempts
630 // to use the specified filter factory to build a pipeline. 632 // to use the specified filter factory to build a pipeline.
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 case kStopping: 1302 case kStopping:
1301 case kStopped: 1303 case kStopped:
1302 NOTREACHED() << "Unexpected state for teardown: " << state_; 1304 NOTREACHED() << "Unexpected state for teardown: " << state_;
1303 break; 1305 break;
1304 // default: intentionally left out to force new states to cause compiler 1306 // default: intentionally left out to force new states to cause compiler
1305 // errors. 1307 // errors.
1306 }; 1308 };
1307 } 1309 }
1308 1310
1309 } // namespace media 1311 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698