summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webmediaplayer_impl.cc
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-29 21:49:49 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-29 21:49:49 +0000
commit38259a7a83545e07681d921564468844c7b03337 (patch)
treeceddb850f76be8ee565d9cc2d3d34d7ae445a1d7 /webkit/glue/webmediaplayer_impl.cc
parent6b33da129646087bbc173a72c84e0690e91740de (diff)
downloadchromium_src-38259a7a83545e07681d921564468844c7b03337.zip
chromium_src-38259a7a83545e07681d921564468844c7b03337.tar.gz
chromium_src-38259a7a83545e07681d921564468844c7b03337.tar.bz2
BufferedDataSource to support server without range request support
This patch will enable BufferedDataSource to support servers with no range request support. It will start a probe request of 1 byte size besides the regular request. If the server does not support range request, we will turn on the is_streamed flag of FFmpeg and will not do any seeking. BUG=17628 TEST=test_shell_tests --gtest_filter=BufferedDataSource.* Review URL: http://codereview.chromium.org/160076 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21999 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webmediaplayer_impl.cc')
-rw-r--r--webkit/glue/webmediaplayer_impl.cc35
1 files changed, 25 insertions, 10 deletions
diff --git a/webkit/glue/webmediaplayer_impl.cc b/webkit/glue/webmediaplayer_impl.cc
index d8bad19..e31139a 100644
--- a/webkit/glue/webmediaplayer_impl.cc
+++ b/webkit/glue/webmediaplayer_impl.cc
@@ -6,6 +6,7 @@
#include "base/command_line.h"
#include "googleurl/src/gurl.h"
+#include "media/base/media_format.h"
#include "media/filters/ffmpeg_audio_decoder.h"
#include "media/filters/ffmpeg_demuxer.h"
#include "media/filters/ffmpeg_video_decoder.h"
@@ -264,9 +265,7 @@ bool WebMediaPlayerImpl::totalBytesKnown() {
bool WebMediaPlayerImpl::hasVideo() const {
DCHECK(MessageLoop::current() == main_loop_);
- size_t width, height;
- pipeline_->GetVideoSize(&width, &height);
- return width != 0 && height != 0;
+ return pipeline_->IsRendered(media::mime_type::kMajorTypeVideo);
}
WebKit::WebSize WebMediaPlayerImpl::naturalSize() const {
@@ -317,14 +316,13 @@ float WebMediaPlayerImpl::maxTimeBuffered() const {
float WebMediaPlayerImpl::maxTimeSeekable() const {
DCHECK(MessageLoop::current() == main_loop_);
- // TODO(scherkus): move this logic down into the pipeline.
- if (pipeline_->GetTotalBytes() == 0) {
+ // If we are performing streaming, we report that we cannot seek at all.
+ // We are using this flag to indicate if the data source supports seeking
+ // or not. We should be able to seek even if we are performing streaming.
+ // TODO(hclam): We need to update this when we have better caching.
+ if (pipeline_->IsStreaming())
return 0.0f;
- }
- double total_bytes = static_cast<double>(pipeline_->GetTotalBytes());
- double buffered_bytes = static_cast<double>(pipeline_->GetBufferedBytes());
- double duration = static_cast<double>(pipeline_->GetDuration().InSecondsF());
- return static_cast<float>(duration * (buffered_bytes / total_bytes));
+ return static_cast<float>(pipeline_->GetDuration().InSecondsF());
}
unsigned long long WebMediaPlayerImpl::bytesLoaded() const {
@@ -354,6 +352,23 @@ void WebMediaPlayerImpl::paint(WebCanvas* canvas,
proxy_->Paint(canvas, rect);
}
+bool WebMediaPlayerImpl::hasSingleSecurityOrigin() const {
+ // TODO(hclam): Implement this.
+ return false;
+}
+
+WebKit::WebMediaPlayer::MovieLoadType
+ WebMediaPlayerImpl::movieLoadType() const {
+ DCHECK(MessageLoop::current() == main_loop_);
+
+ // TODO(hclam): If the pipeline is performing streaming, we say that this is
+ // a live stream. But instead it should be a StoredStream if we have proper
+ // caching.
+ if (pipeline_->IsStreaming())
+ return WebKit::WebMediaPlayer::LiveStream;
+ return WebKit::WebMediaPlayer::Unknown;
+}
+
void WebMediaPlayerImpl::WillDestroyCurrentMessageLoop() {
Destroy();
main_loop_ = NULL;