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

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

Issue 1509663003: make multibuffer work with layout tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@media_cache.integrate3
Patch Set: merged & formatted Created 5 years 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 "media/blink/webmediaplayer_impl.h" 5 #include "media/blink/webmediaplayer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <string> 10 #include <string>
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 defer_load_cb_.Run(base::Bind( 249 defer_load_cb_.Run(base::Bind(
250 &WebMediaPlayerImpl::DoLoad, AsWeakPtr(), load_type, url, cors_mode)); 250 &WebMediaPlayerImpl::DoLoad, AsWeakPtr(), load_type, url, cors_mode));
251 return; 251 return;
252 } 252 }
253 DoLoad(load_type, url, cors_mode); 253 DoLoad(load_type, url, cors_mode);
254 } 254 }
255 255
256 void WebMediaPlayerImpl::DoLoad(LoadType load_type, 256 void WebMediaPlayerImpl::DoLoad(LoadType load_type,
257 const blink::WebURL& url, 257 const blink::WebURL& url,
258 CORSMode cors_mode) { 258 CORSMode cors_mode) {
259 DVLOG(1) << __FUNCTION__;
259 DCHECK(main_task_runner_->BelongsToCurrentThread()); 260 DCHECK(main_task_runner_->BelongsToCurrentThread());
260 261
261 GURL gurl(url); 262 GURL gurl(url);
262 ReportMetrics(load_type, gurl, 263 ReportMetrics(load_type, gurl,
263 GURL(frame_->document().securityOrigin().toString())); 264 GURL(frame_->document().securityOrigin().toString()));
264 265
265 // Set subresource URL for crash reporting. 266 // Set subresource URL for crash reporting.
266 base::debug::SetCrashKeyValue("subresource_url", gurl.spec()); 267 base::debug::SetCrashKeyValue("subresource_url", gurl.spec());
267 268
268 load_type_ = load_type; 269 load_type_ = load_type;
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 922
922 // Ignore state changes until we've completed all outstanding seeks. 923 // Ignore state changes until we've completed all outstanding seeks.
923 if (seeking_ || pending_seek_) 924 if (seeking_ || pending_seek_)
924 return; 925 return;
925 926
926 ended_ = true; 927 ended_ = true;
927 client_->timeChanged(); 928 client_->timeChanged();
928 } 929 }
929 930
930 void WebMediaPlayerImpl::OnPipelineError(PipelineStatus error) { 931 void WebMediaPlayerImpl::OnPipelineError(PipelineStatus error) {
932 DVLOG(1) << __FUNCTION__;
931 DCHECK(main_task_runner_->BelongsToCurrentThread()); 933 DCHECK(main_task_runner_->BelongsToCurrentThread());
932 DCHECK_NE(error, PIPELINE_OK); 934 DCHECK_NE(error, PIPELINE_OK);
933 935
934 if (ready_state_ == WebMediaPlayer::ReadyStateHaveNothing) { 936 if (ready_state_ == WebMediaPlayer::ReadyStateHaveNothing) {
935 // Any error that occurs before reaching ReadyStateHaveMetadata should 937 // Any error that occurs before reaching ReadyStateHaveMetadata should
936 // be considered a format error. 938 // be considered a format error.
937 SetNetworkState(WebMediaPlayer::NetworkStateFormatError); 939 SetNetworkState(WebMediaPlayer::NetworkStateFormatError);
938 return; 940 return;
939 } 941 }
940 942
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 if (chunk_demuxer_) 1133 if (chunk_demuxer_)
1132 chunk_demuxer_->StartWaitingForSeek(seek_time_); 1134 chunk_demuxer_->StartWaitingForSeek(seek_time_);
1133 1135
1134 resuming_ = true; 1136 resuming_ = true;
1135 pipeline_.Resume(CreateRenderer(), seek_time_, 1137 pipeline_.Resume(CreateRenderer(), seek_time_,
1136 BIND_TO_RENDER_LOOP1(&WebMediaPlayerImpl::OnPipelineSeeked, 1138 BIND_TO_RENDER_LOOP1(&WebMediaPlayerImpl::OnPipelineSeeked,
1137 time_changed)); 1139 time_changed));
1138 } 1140 }
1139 1141
1140 void WebMediaPlayerImpl::DataSourceInitialized(bool success) { 1142 void WebMediaPlayerImpl::DataSourceInitialized(bool success) {
1143 DVLOG(1) << __FUNCTION__;
1141 DCHECK(main_task_runner_->BelongsToCurrentThread()); 1144 DCHECK(main_task_runner_->BelongsToCurrentThread());
1142 1145
1143 if (!success) { 1146 if (!success) {
1144 SetNetworkState(WebMediaPlayer::NetworkStateFormatError); 1147 SetNetworkState(WebMediaPlayer::NetworkStateFormatError);
1145 return; 1148 return;
1146 } 1149 }
1147 1150
1148 StartPipeline(); 1151 StartPipeline();
1149 } 1152 }
1150 1153
1151 void WebMediaPlayerImpl::NotifyDownloading(bool is_downloading) { 1154 void WebMediaPlayerImpl::NotifyDownloading(bool is_downloading) {
1155 DVLOG(1) << __FUNCTION__;
1152 if (!is_downloading && network_state_ == WebMediaPlayer::NetworkStateLoading) 1156 if (!is_downloading && network_state_ == WebMediaPlayer::NetworkStateLoading)
1153 SetNetworkState(WebMediaPlayer::NetworkStateIdle); 1157 SetNetworkState(WebMediaPlayer::NetworkStateIdle);
1154 else if (is_downloading && network_state_ == WebMediaPlayer::NetworkStateIdle) 1158 else if (is_downloading && network_state_ == WebMediaPlayer::NetworkStateIdle)
1155 SetNetworkState(WebMediaPlayer::NetworkStateLoading); 1159 SetNetworkState(WebMediaPlayer::NetworkStateLoading);
1156 media_log_->AddEvent( 1160 media_log_->AddEvent(
1157 media_log_->CreateBooleanEvent( 1161 media_log_->CreateBooleanEvent(
1158 MediaLogEvent::NETWORK_ACTIVITY_SET, 1162 MediaLogEvent::NETWORK_ACTIVITY_SET,
1159 "is_downloading_data", is_downloading)); 1163 "is_downloading_data", is_downloading));
1160 } 1164 }
1161 1165
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 << ", Video: " << stats.video_memory_usage << ", DataSource: " 1367 << ", Video: " << stats.video_memory_usage << ", DataSource: "
1364 << (data_source_ ? data_source_->GetMemoryUsage() : 0) 1368 << (data_source_ ? data_source_->GetMemoryUsage() : 0)
1365 << ", Demuxer: " << demuxer_memory_usage; 1369 << ", Demuxer: " << demuxer_memory_usage;
1366 1370
1367 const int64_t delta = current_memory_usage - last_reported_memory_usage_; 1371 const int64_t delta = current_memory_usage - last_reported_memory_usage_;
1368 last_reported_memory_usage_ = current_memory_usage; 1372 last_reported_memory_usage_ = current_memory_usage;
1369 adjust_allocated_memory_cb_.Run(delta); 1373 adjust_allocated_memory_cb_.Run(delta);
1370 } 1374 }
1371 1375
1372 } // namespace media 1376 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698