| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |