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

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

Issue 316003: Do not lower our ready state if the media resource is completely loaded. (Closed)
Patch Set: Created 11 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008-2009 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/glue/webmediaplayer_impl.h" 5 #include "webkit/glue/webmediaplayer_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "googleurl/src/gurl.h" 8 #include "googleurl/src/gurl.h"
9 #include "media/base/media_format.h" 9 #include "media/base/media_format.h"
10 #include "media/filters/ffmpeg_audio_decoder.h" 10 #include "media/filters/ffmpeg_audio_decoder.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 // cause extra pre-rolling and will break servers without range request 282 // cause extra pre-rolling and will break servers without range request
283 // support. 283 // support.
284 // 284 //
285 // We still have to notify WebKit that time has changed otherwise 285 // We still have to notify WebKit that time has changed otherwise
286 // HTMLMediaElement gets into an inconsistent state. 286 // HTMLMediaElement gets into an inconsistent state.
287 if (pipeline_->GetCurrentTime().ToInternalValue() == 0 && seconds == 0) { 287 if (pipeline_->GetCurrentTime().ToInternalValue() == 0 && seconds == 0) {
288 GetClient()->timeChanged(); 288 GetClient()->timeChanged();
289 return; 289 return;
290 } 290 }
291 291
292 // Drop our ready state if the media file isn't fully loaded.
293 if (!pipeline_->IsLoaded()) {
294 SetReadyState(WebKit::WebMediaPlayer::HaveMetadata);
295 }
296
292 // Try to preserve as much accuracy as possible. 297 // Try to preserve as much accuracy as possible.
293 float microseconds = seconds * base::Time::kMicrosecondsPerSecond; 298 float microseconds = seconds * base::Time::kMicrosecondsPerSecond;
294 SetReadyState(WebKit::WebMediaPlayer::HaveMetadata);
295 pipeline_->Seek( 299 pipeline_->Seek(
296 base::TimeDelta::FromMicroseconds(static_cast<int64>(microseconds)), 300 base::TimeDelta::FromMicroseconds(static_cast<int64>(microseconds)),
297 NewCallback(proxy_.get(), 301 NewCallback(proxy_.get(),
298 &WebMediaPlayerImpl::Proxy::PipelineSeekCallback)); 302 &WebMediaPlayerImpl::Proxy::PipelineSeekCallback));
299 } 303 }
300 304
301 void WebMediaPlayerImpl::setEndTime(float seconds) { 305 void WebMediaPlayerImpl::setEndTime(float seconds) {
302 DCHECK(MessageLoop::current() == main_loop_); 306 DCHECK(MessageLoop::current() == main_loop_);
303 307
304 // TODO(hclam): add method call when it has been implemented. 308 // TODO(hclam): add method call when it has been implemented.
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 } 645 }
642 } 646 }
643 647
644 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { 648 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() {
645 DCHECK(MessageLoop::current() == main_loop_); 649 DCHECK(MessageLoop::current() == main_loop_);
646 DCHECK(client_); 650 DCHECK(client_);
647 return client_; 651 return client_;
648 } 652 }
649 653
650 } // namespace webkit_glue 654 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698