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

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: 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 defer_load_cb_.Run(base::Bind( 235 defer_load_cb_.Run(base::Bind(
236 &WebMediaPlayerImpl::DoLoad, AsWeakPtr(), load_type, url, cors_mode)); 236 &WebMediaPlayerImpl::DoLoad, AsWeakPtr(), load_type, url, cors_mode));
237 return; 237 return;
238 } 238 }
239 DoLoad(load_type, url, cors_mode); 239 DoLoad(load_type, url, cors_mode);
240 } 240 }
241 241
242 void WebMediaPlayerImpl::DoLoad(LoadType load_type, 242 void WebMediaPlayerImpl::DoLoad(LoadType load_type,
243 const blink::WebURL& url, 243 const blink::WebURL& url,
244 CORSMode cors_mode) { 244 CORSMode cors_mode) {
245 DVLOG(1) << __FUNCTION__;
245 DCHECK(main_task_runner_->BelongsToCurrentThread()); 246 DCHECK(main_task_runner_->BelongsToCurrentThread());
246 247
247 GURL gurl(url); 248 GURL gurl(url);
248 ReportMetrics(load_type, gurl, 249 ReportMetrics(load_type, gurl,
249 GURL(frame_->document().securityOrigin().toString())); 250 GURL(frame_->document().securityOrigin().toString()));
250 251
251 // Set subresource URL for crash reporting. 252 // Set subresource URL for crash reporting.
252 base::debug::SetCrashKeyValue("subresource_url", gurl.spec()); 253 base::debug::SetCrashKeyValue("subresource_url", gurl.spec());
253 254
254 load_type_ = load_type; 255 load_type_ = load_type;
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 834
834 // Ignore state changes until we've completed all outstanding seeks. 835 // Ignore state changes until we've completed all outstanding seeks.
835 if (seeking_ || pending_seek_) 836 if (seeking_ || pending_seek_)
836 return; 837 return;
837 838
838 ended_ = true; 839 ended_ = true;
839 client_->timeChanged(); 840 client_->timeChanged();
840 } 841 }
841 842
842 void WebMediaPlayerImpl::OnPipelineError(PipelineStatus error) { 843 void WebMediaPlayerImpl::OnPipelineError(PipelineStatus error) {
844 DVLOG(1) << __FUNCTION__;
843 DCHECK(main_task_runner_->BelongsToCurrentThread()); 845 DCHECK(main_task_runner_->BelongsToCurrentThread());
844 DCHECK_NE(error, PIPELINE_OK); 846 DCHECK_NE(error, PIPELINE_OK);
845 847
846 if (ready_state_ == WebMediaPlayer::ReadyStateHaveNothing) { 848 if (ready_state_ == WebMediaPlayer::ReadyStateHaveNothing) {
847 // Any error that occurs before reaching ReadyStateHaveMetadata should 849 // Any error that occurs before reaching ReadyStateHaveMetadata should
848 // be considered a format error. 850 // be considered a format error.
849 SetNetworkState(WebMediaPlayer::NetworkStateFormatError); 851 SetNetworkState(WebMediaPlayer::NetworkStateFormatError);
850 return; 852 return;
851 } 853 }
852 854
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 scoped_ptr<WebInbandTextTrackImpl> web_inband_text_track( 934 scoped_ptr<WebInbandTextTrackImpl> web_inband_text_track(
933 new WebInbandTextTrackImpl(web_kind, web_label, web_language, web_id)); 935 new WebInbandTextTrackImpl(web_kind, web_label, web_language, web_id));
934 936
935 scoped_ptr<TextTrack> text_track(new TextTrackImpl( 937 scoped_ptr<TextTrack> text_track(new TextTrackImpl(
936 main_task_runner_, client_, web_inband_text_track.Pass())); 938 main_task_runner_, client_, web_inband_text_track.Pass()));
937 939
938 done_cb.Run(text_track.Pass()); 940 done_cb.Run(text_track.Pass());
939 } 941 }
940 942
941 void WebMediaPlayerImpl::DataSourceInitialized(bool success) { 943 void WebMediaPlayerImpl::DataSourceInitialized(bool success) {
944 DVLOG(1) << __FUNCTION__;
942 DCHECK(main_task_runner_->BelongsToCurrentThread()); 945 DCHECK(main_task_runner_->BelongsToCurrentThread());
943 946
944 if (!success) { 947 if (!success) {
945 SetNetworkState(WebMediaPlayer::NetworkStateFormatError); 948 SetNetworkState(WebMediaPlayer::NetworkStateFormatError);
946 return; 949 return;
947 } 950 }
948 951
949 StartPipeline(); 952 StartPipeline();
950 } 953 }
951 954
952 void WebMediaPlayerImpl::NotifyDownloading(bool is_downloading) { 955 void WebMediaPlayerImpl::NotifyDownloading(bool is_downloading) {
956 DVLOG(1) << __FUNCTION__;
953 if (!is_downloading && network_state_ == WebMediaPlayer::NetworkStateLoading) 957 if (!is_downloading && network_state_ == WebMediaPlayer::NetworkStateLoading)
954 SetNetworkState(WebMediaPlayer::NetworkStateIdle); 958 SetNetworkState(WebMediaPlayer::NetworkStateIdle);
955 else if (is_downloading && network_state_ == WebMediaPlayer::NetworkStateIdle) 959 else if (is_downloading && network_state_ == WebMediaPlayer::NetworkStateIdle)
956 SetNetworkState(WebMediaPlayer::NetworkStateLoading); 960 SetNetworkState(WebMediaPlayer::NetworkStateLoading);
957 media_log_->AddEvent( 961 media_log_->AddEvent(
958 media_log_->CreateBooleanEvent( 962 media_log_->CreateBooleanEvent(
959 MediaLogEvent::NETWORK_ACTIVITY_SET, 963 MediaLogEvent::NETWORK_ACTIVITY_SET,
960 "is_downloading_data", is_downloading)); 964 "is_downloading_data", is_downloading));
961 } 965 }
962 966
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 << ", Video: " << stats.video_memory_usage << ", DataSource: " 1163 << ", Video: " << stats.video_memory_usage << ", DataSource: "
1160 << (data_source_ ? data_source_->GetMemoryUsage() : 0) 1164 << (data_source_ ? data_source_->GetMemoryUsage() : 0)
1161 << ", Demuxer: " << demuxer_memory_usage; 1165 << ", Demuxer: " << demuxer_memory_usage;
1162 1166
1163 const int64_t delta = current_memory_usage - last_reported_memory_usage_; 1167 const int64_t delta = current_memory_usage - last_reported_memory_usage_;
1164 last_reported_memory_usage_ = current_memory_usage; 1168 last_reported_memory_usage_ = current_memory_usage;
1165 adjust_allocated_memory_cb_.Run(delta); 1169 adjust_allocated_memory_cb_.Run(delta);
1166 } 1170 }
1167 1171
1168 } // namespace media 1172 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698