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

Side by Side Diff: webkit/media/webmediaplayer_impl.cc

Issue 9860027: Remove DemuxerFactory and URL parameter from Pipeline. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: added some todos Created 8 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 | Annotate | Revision Log
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 "webkit/media/webmediaplayer_impl.h" 5 #include "webkit/media/webmediaplayer_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 setPreload(GetClient()->preload()); 214 setPreload(GetClient()->preload());
215 215
216 SetNetworkState(WebKit::WebMediaPlayer::Loading); 216 SetNetworkState(WebKit::WebMediaPlayer::Loading);
217 SetReadyState(WebKit::WebMediaPlayer::HaveNothing); 217 SetReadyState(WebKit::WebMediaPlayer::HaveNothing);
218 media_log_->AddEvent(media_log_->CreateLoadEvent(url.spec())); 218 media_log_->AddEvent(media_log_->CreateLoadEvent(url.spec()));
219 219
220 // Media streams pipelines can start immediately. 220 // Media streams pipelines can start immediately.
221 if (BuildMediaStreamCollection(url, media_stream_client_, 221 if (BuildMediaStreamCollection(url, media_stream_client_,
222 message_loop_factory_.get(), 222 message_loop_factory_.get(),
223 filter_collection_.get())) { 223 filter_collection_.get())) {
224 StartPipeline(gurl); 224 StartPipeline();
225 return; 225 return;
226 } 226 }
227 227
228 // Media source pipelines can start immediately. 228 // Media source pipelines can start immediately.
229 if (BuildMediaSourceCollection(url, GetClient()->sourceURL(), proxy_, 229 if (BuildMediaSourceCollection(url, GetClient()->sourceURL(), proxy_,
230 message_loop_factory_.get(), 230 message_loop_factory_.get(),
231 filter_collection_.get())) { 231 filter_collection_.get())) {
232 StartPipeline(gurl); 232 StartPipeline();
233 return; 233 return;
234 } 234 }
235 235
236 // Otherwise it's a regular request which requires resolving the URL first. 236 // Otherwise it's a regular request which requires resolving the URL first.
237 proxy_->set_data_source( 237 proxy_->set_data_source(
238 new BufferedDataSource(main_loop_, frame_, media_log_)); 238 new BufferedDataSource(main_loop_, frame_, media_log_));
239 proxy_->data_source()->Initialize(url, base::Bind( 239 proxy_->data_source()->Initialize(url, base::Bind(
240 &WebMediaPlayerImpl::DataSourceInitialized, 240 &WebMediaPlayerImpl::DataSourceInitialized,
241 base::Unretained(this), gurl)); 241 base::Unretained(this), gurl));
242 } 242 }
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 const GURL& gurl, 817 const GURL& gurl,
818 media::PipelineStatus status) { 818 media::PipelineStatus status) {
819 DCHECK_EQ(main_loop_, MessageLoop::current()); 819 DCHECK_EQ(main_loop_, MessageLoop::current());
820 820
821 if (status != media::PIPELINE_OK) { 821 if (status != media::PIPELINE_OK) {
822 SetNetworkState(WebKit::WebMediaPlayer::FormatError); 822 SetNetworkState(WebKit::WebMediaPlayer::FormatError);
823 Repaint(); 823 Repaint();
824 return; 824 return;
825 } 825 }
826 826
827 // TODO(scherkus): this is leftover from removing DemuxerFactory -- instead
828 // our DataSource should report this information. See http://crbug.com/120426
829 bool local_source = !gurl.SchemeIs("http") && !gurl.SchemeIs("https");
830
827 BuildDefaultCollection(proxy_->data_source(), 831 BuildDefaultCollection(proxy_->data_source(),
832 local_source,
828 message_loop_factory_.get(), 833 message_loop_factory_.get(),
829 filter_collection_.get()); 834 filter_collection_.get());
830 StartPipeline(gurl); 835 StartPipeline();
831 } 836 }
832 837
833 void WebMediaPlayerImpl::StartPipeline(const GURL& gurl) { 838 void WebMediaPlayerImpl::StartPipeline() {
834 started_ = true; 839 started_ = true;
835 pipeline_->Start( 840 pipeline_->Start(
836 filter_collection_.Pass(), 841 filter_collection_.Pass(),
837 gurl.spec(),
838 base::Bind(&WebMediaPlayerProxy::PipelineEndedCallback, proxy_.get()), 842 base::Bind(&WebMediaPlayerProxy::PipelineEndedCallback, proxy_.get()),
839 base::Bind(&WebMediaPlayerProxy::PipelineErrorCallback, proxy_.get()), 843 base::Bind(&WebMediaPlayerProxy::PipelineErrorCallback, proxy_.get()),
840 base::Bind(&WebMediaPlayerProxy::NetworkEventCallback, proxy_.get()), 844 base::Bind(&WebMediaPlayerProxy::NetworkEventCallback, proxy_.get()),
841 base::Bind(&WebMediaPlayerProxy::PipelineInitializationCallback, 845 base::Bind(&WebMediaPlayerProxy::PipelineInitializationCallback,
842 proxy_.get())); 846 proxy_.get()));
843 } 847 }
844 848
845 void WebMediaPlayerImpl::SetNetworkState( 849 void WebMediaPlayerImpl::SetNetworkState(
846 WebKit::WebMediaPlayer::NetworkState state) { 850 WebKit::WebMediaPlayer::NetworkState state) {
847 DCHECK_EQ(main_loop_, MessageLoop::current()); 851 DCHECK_EQ(main_loop_, MessageLoop::current());
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 return audio_source_provider_; 907 return audio_source_provider_;
904 } 908 }
905 909
906 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { 910 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() {
907 DCHECK_EQ(main_loop_, MessageLoop::current()); 911 DCHECK_EQ(main_loop_, MessageLoop::current());
908 incremented_externally_allocated_memory_ = true; 912 incremented_externally_allocated_memory_ = true;
909 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); 913 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory);
910 } 914 }
911 915
912 } // namespace webkit_media 916 } // namespace webkit_media
OLDNEW
« media/filters/ffmpeg_demuxer_unittest.cc ('K') | « webkit/media/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698