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

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

Issue 1518013: Don't forcibly set our network state to NETWORK_LOADING after media initializes. (Closed)
Patch Set: Created 10 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
« 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "media/base/limits.h" 9 #include "media/base/limits.h"
10 #include "media/base/media_format.h" 10 #include "media/base/media_format.h"
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 void WebMediaPlayerImpl::OnPipelineInitialize() { 568 void WebMediaPlayerImpl::OnPipelineInitialize() {
569 DCHECK(MessageLoop::current() == main_loop_); 569 DCHECK(MessageLoop::current() == main_loop_);
570 if (pipeline_->GetError() == media::PIPELINE_OK) { 570 if (pipeline_->GetError() == media::PIPELINE_OK) {
571 // Only keep one time range starting from 0. 571 // Only keep one time range starting from 0.
572 WebKit::WebTimeRanges new_buffered(static_cast<size_t>(1)); 572 WebKit::WebTimeRanges new_buffered(static_cast<size_t>(1));
573 new_buffered[0].start = 0.0f; 573 new_buffered[0].start = 0.0f;
574 new_buffered[0].end = 574 new_buffered[0].end =
575 static_cast<float>(pipeline_->GetDuration().InSecondsF()); 575 static_cast<float>(pipeline_->GetDuration().InSecondsF());
576 buffered_.swap(new_buffered); 576 buffered_.swap(new_buffered);
577 577
578 // Since we have initialized the pipeline, say we have everything. 578 // Since we have initialized the pipeline, say we have everything otherwise
579 // we'll remain either loading/idle.
579 // TODO(hclam): change this to report the correct status. 580 // TODO(hclam): change this to report the correct status.
580 SetReadyState(WebKit::WebMediaPlayer::HaveMetadata); 581 SetReadyState(WebKit::WebMediaPlayer::HaveMetadata);
581 SetReadyState(WebKit::WebMediaPlayer::HaveEnoughData); 582 SetReadyState(WebKit::WebMediaPlayer::HaveEnoughData);
582 if (pipeline_->IsLoaded()) { 583 if (pipeline_->IsLoaded()) {
583 SetNetworkState(WebKit::WebMediaPlayer::Loaded); 584 SetNetworkState(WebKit::WebMediaPlayer::Loaded);
584 } else {
585 SetNetworkState(WebKit::WebMediaPlayer::Loading);
586 } 585 }
587 } else { 586 } else {
588 // TODO(hclam): should use pipeline_->GetError() to determine the state 587 // TODO(hclam): should use pipeline_->GetError() to determine the state
589 // properly and reports error using MediaError. 588 // properly and reports error using MediaError.
590 // WebKit uses FormatError to indicate an error for bogus URL or bad file. 589 // WebKit uses FormatError to indicate an error for bogus URL or bad file.
591 // Since we are at the initialization stage we can safely treat every error 590 // Since we are at the initialization stage we can safely treat every error
592 // as format error. Should post a task to call to |webmediaplayer_|. 591 // as format error. Should post a task to call to |webmediaplayer_|.
593 SetNetworkState(WebKit::WebMediaPlayer::FormatError); 592 SetNetworkState(WebKit::WebMediaPlayer::FormatError);
594 } 593 }
595 594
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 } 693 }
695 } 694 }
696 695
697 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { 696 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() {
698 DCHECK(MessageLoop::current() == main_loop_); 697 DCHECK(MessageLoop::current() == main_loop_);
699 DCHECK(client_); 698 DCHECK(client_);
700 return client_; 699 return client_;
701 } 700 }
702 701
703 } // namespace webkit_glue 702 } // 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