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

Side by Side Diff: content/renderer/media/webmediaplayer_impl.cc

Issue 306953005: Changing constructor of BufferedDataSource to accept GURL and CORSMode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/renderer/media/webmediaplayer_impl.h" 5 #include "content/renderer/media/webmediaplayer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 311
312 // Media source pipelines can start immediately. 312 // Media source pipelines can start immediately.
313 if (load_type == LoadTypeMediaSource) { 313 if (load_type == LoadTypeMediaSource) {
314 supports_save_ = false; 314 supports_save_ = false;
315 StartPipeline(); 315 StartPipeline();
316 return; 316 return;
317 } 317 }
318 318
319 // Otherwise it's a regular request which requires resolving the URL first. 319 // Otherwise it's a regular request which requires resolving the URL first.
320 data_source_.reset(new BufferedDataSource( 320 data_source_.reset(new BufferedDataSource(
321 url,
322 static_cast<BufferedResourceLoader::CORSMode>(cors_mode),
321 main_loop_, 323 main_loop_,
322 frame_, 324 frame_,
323 media_log_.get(), 325 media_log_.get(),
324 &buffered_data_source_host_, 326 &buffered_data_source_host_,
325 base::Bind(&WebMediaPlayerImpl::NotifyDownloading, AsWeakPtr()))); 327 base::Bind(&WebMediaPlayerImpl::NotifyDownloading, AsWeakPtr())));
326 data_source_->Initialize( 328 data_source_->Initialize(base::Bind(
327 url, static_cast<BufferedResourceLoader::CORSMode>(cors_mode), 329 &WebMediaPlayerImpl::DataSourceInitialized, AsWeakPtr(), gurl));
328 base::Bind(
329 &WebMediaPlayerImpl::DataSourceInitialized,
330 AsWeakPtr(), gurl));
331 330
332 is_local_source_ = !gurl.SchemeIsHTTPOrHTTPS(); 331 is_local_source_ = !gurl.SchemeIsHTTPOrHTTPS();
333 } 332 }
334 333
335 void WebMediaPlayerImpl::play() { 334 void WebMediaPlayerImpl::play() {
336 DCHECK(main_loop_->BelongsToCurrentThread()); 335 DCHECK(main_loop_->BelongsToCurrentThread());
337 336
338 paused_ = false; 337 paused_ = false;
339 pipeline_.SetPlaybackRate(playback_rate_); 338 pipeline_.SetPlaybackRate(playback_rate_);
340 if (data_source_) 339 if (data_source_)
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 << "Invalid URL in default_url: " << default_url; 1106 << "Invalid URL in default_url: " << default_url;
1108 1107
1109 client_->keyMessage( 1108 client_->keyMessage(
1110 WebString::fromUTF8(GetPrefixedKeySystemName(current_key_system_)), 1109 WebString::fromUTF8(GetPrefixedKeySystemName(current_key_system_)),
1111 WebString::fromUTF8(session_id), 1110 WebString::fromUTF8(session_id),
1112 message.empty() ? NULL : &message[0], 1111 message.empty() ? NULL : &message[0],
1113 message.size(), 1112 message.size(),
1114 default_url_gurl); 1113 default_url_gurl);
1115 } 1114 }
1116 1115
1117 void WebMediaPlayerImpl::DataSourceInitialized(const GURL& gurl, bool success) { 1116 void WebMediaPlayerImpl::DataSourceInitialized(const GURL& gurl, bool success) {
scherkus (not reviewing) 2014/05/30 20:45:14 it doesn't look like |gurl| is used -- can you als
amogh.bihani 2014/06/02 06:11:01 Done.
1118 DCHECK(main_loop_->BelongsToCurrentThread()); 1117 DCHECK(main_loop_->BelongsToCurrentThread());
1119 1118
1120 if (!success) { 1119 if (!success) {
1121 SetNetworkState(WebMediaPlayer::NetworkStateFormatError); 1120 SetNetworkState(WebMediaPlayer::NetworkStateFormatError);
1122 1121
1123 // TODO(scherkus): This should be handled by HTMLMediaElement and controls 1122 // TODO(scherkus): This should be handled by HTMLMediaElement and controls
1124 // should know when to invalidate themselves http://crbug.com/337015 1123 // should know when to invalidate themselves http://crbug.com/337015
1125 InvalidateOnMainThread(); 1124 InvalidateOnMainThread();
1126 return; 1125 return;
1127 } 1126 }
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1375 compositor_task_runner_->PostTask(FROM_HERE, 1374 compositor_task_runner_->PostTask(FROM_HERE,
1376 base::Bind(&GetCurrentFrameAndSignal, 1375 base::Bind(&GetCurrentFrameAndSignal,
1377 base::Unretained(compositor_), 1376 base::Unretained(compositor_),
1378 &video_frame, 1377 &video_frame,
1379 &event)); 1378 &event));
1380 event.Wait(); 1379 event.Wait();
1381 return video_frame; 1380 return video_frame;
1382 } 1381 }
1383 1382
1384 } // namespace content 1383 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698