| OLD | NEW |
| 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 } | 255 } |
| 256 | 256 |
| 257 bool WebMediaPlayerImpl::supportsSave() const { | 257 bool WebMediaPlayerImpl::supportsSave() const { |
| 258 DCHECK(MessageLoop::current() == main_loop_); | 258 DCHECK(MessageLoop::current() == main_loop_); |
| 259 return true; | 259 return true; |
| 260 } | 260 } |
| 261 | 261 |
| 262 void WebMediaPlayerImpl::seek(float seconds) { | 262 void WebMediaPlayerImpl::seek(float seconds) { |
| 263 DCHECK(MessageLoop::current() == main_loop_); | 263 DCHECK(MessageLoop::current() == main_loop_); |
| 264 | 264 |
| 265 // TODO(scherkus): WebKit fires a seek(0) at the very start, however pipeline | 265 // WebKit fires a seek(0) at the very start, however pipeline already does a |
| 266 // already does a seek(0) internally. Investigate whether doing two seek(0) | 266 // seek(0) internally. Avoid doing seek(0) the second time because this will |
| 267 // at the start impacts startup latency. | 267 // cause extra pre-rolling and will break servers without range request |
| 268 // support. |
| 269 if (pipeline_->GetCurrentTime().ToInternalValue() == 0 && seconds == 0) { |
| 270 return; |
| 271 } |
| 268 | 272 |
| 269 // Try to preserve as much accuracy as possible. | 273 // Try to preserve as much accuracy as possible. |
| 270 float microseconds = seconds * base::Time::kMicrosecondsPerSecond; | 274 float microseconds = seconds * base::Time::kMicrosecondsPerSecond; |
| 271 pipeline_->Seek( | 275 pipeline_->Seek( |
| 272 base::TimeDelta::FromMicroseconds(static_cast<int64>(microseconds)), | 276 base::TimeDelta::FromMicroseconds(static_cast<int64>(microseconds)), |
| 273 NewCallback(proxy_.get(), | 277 NewCallback(proxy_.get(), |
| 274 &WebMediaPlayerImpl::Proxy::PipelineSeekCallback)); | 278 &WebMediaPlayerImpl::Proxy::PipelineSeekCallback)); |
| 275 } | 279 } |
| 276 | 280 |
| 277 void WebMediaPlayerImpl::setEndTime(float seconds) { | 281 void WebMediaPlayerImpl::setEndTime(float seconds) { |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 } | 556 } |
| 553 } | 557 } |
| 554 | 558 |
| 555 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { | 559 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { |
| 556 DCHECK(MessageLoop::current() == main_loop_); | 560 DCHECK(MessageLoop::current() == main_loop_); |
| 557 DCHECK(client_); | 561 DCHECK(client_); |
| 558 return client_; | 562 return client_; |
| 559 } | 563 } |
| 560 | 564 |
| 561 } // namespace webkit_glue | 565 } // namespace webkit_glue |
| OLD | NEW |