| Index: webkit/glue/webmediaplayer_impl.cc
|
| diff --git a/webkit/glue/webmediaplayer_impl.cc b/webkit/glue/webmediaplayer_impl.cc
|
| index e13d942cc84d42059d69a5743bdf980ea338e197..224d2d825323e3faed3eee76ddc7dab927484911 100644
|
| --- a/webkit/glue/webmediaplayer_impl.cc
|
| +++ b/webkit/glue/webmediaplayer_impl.cc
|
| @@ -208,6 +208,20 @@ void WebMediaPlayerImpl::Proxy::NetworkEventTask() {
|
| }
|
| }
|
|
|
| +void WebMediaPlayerImpl::Proxy::CopyBitmapToCanvas(const SkBitmap& bitmap,
|
| + skia::PlatformCanvas* canvas,
|
| + const gfx::Rect& dest_rect) {
|
| + DCHECK(MessageLoop::current() == render_loop_);
|
| + if (video_renderer_)
|
| + video_renderer_->CopyBitmapToCanvas(bitmap, canvas, dest_rect);
|
| +}
|
| +
|
| +void WebMediaPlayerImpl::Proxy::GetCurrentBitmap(SkBitmap* bitmap) {
|
| + DCHECK(MessageLoop::current() == render_loop_);
|
| + if (video_renderer_)
|
| + video_renderer_->GetCurrentBitmap(bitmap);
|
| +}
|
| +
|
| void WebMediaPlayerImpl::Proxy::GetCurrentFrame(
|
| scoped_refptr<media::VideoFrame>* frame_out) {
|
| if (video_renderer_)
|
| @@ -233,6 +247,7 @@ WebMediaPlayerImpl::WebMediaPlayerImpl(
|
| pipeline_(NULL),
|
| pipeline_thread_("PipelineThread"),
|
| paused_(true),
|
| + seeking_(false),
|
| playback_rate_(0.0f),
|
| client_(client),
|
| proxy_(NULL),
|
| @@ -368,11 +383,6 @@ void WebMediaPlayerImpl::seek(float seconds) {
|
| return;
|
| }
|
|
|
| - // Drop our ready state if the media file isn't fully loaded.
|
| - if (!pipeline_->IsLoaded()) {
|
| - SetReadyState(WebKit::WebMediaPlayer::HaveMetadata);
|
| - }
|
| -
|
| // Try to preserve as much accuracy as possible.
|
| float microseconds = seconds * base::Time::kMicrosecondsPerSecond;
|
| base::TimeDelta seek_time =
|
| @@ -383,6 +393,12 @@ void WebMediaPlayerImpl::seek(float seconds) {
|
| paused_time_ = seek_time;
|
| }
|
|
|
| + seeking_ = true;
|
| +
|
| + // If available, take a copy of the current video frame to display while
|
| + // seeking.
|
| + proxy_->GetCurrentBitmap(&cached_bitmap_);
|
| +
|
| // Kick off the asynchronous seek!
|
| pipeline_->Seek(
|
| seek_time,
|
| @@ -476,7 +492,7 @@ bool WebMediaPlayerImpl::seeking() const {
|
| if (ready_state_ == WebKit::WebMediaPlayer::HaveNothing)
|
| return false;
|
|
|
| - return ready_state_ == WebKit::WebMediaPlayer::HaveMetadata;
|
| + return seeking_;
|
| }
|
|
|
| float WebMediaPlayerImpl::duration() const {
|
| @@ -563,7 +579,11 @@ void WebMediaPlayerImpl::paint(WebCanvas* canvas,
|
| DCHECK(proxy_);
|
|
|
| #if WEBKIT_USING_SKIA
|
| - proxy_->Paint(canvas, rect);
|
| + if (seeking_ && !cached_bitmap_.empty()) {
|
| + proxy_->CopyBitmapToCanvas(cached_bitmap_, canvas, rect);
|
| + } else {
|
| + proxy_->Paint(canvas, rect);
|
| + }
|
| #elif WEBKIT_USING_CG
|
| // Get the current scaling in X and Y.
|
| CGAffineTransform mat = CGContextGetCTM(canvas);
|
| @@ -593,7 +613,12 @@ void WebMediaPlayerImpl::paint(WebCanvas* canvas,
|
|
|
| // Draw to our temporary skia canvas.
|
| gfx::Rect normalized_rect(scaled_width, scaled_height);
|
| - proxy_->Paint(skia_canvas_.get(), normalized_rect);
|
| + if (seeking_ && !cached_bitmap_.empty()) {
|
| + proxy_->CopyBitmapToCanvas(
|
| + cached_bitmap_, skia_canvas_.get(), normalized_rect);
|
| + } else {
|
| + proxy_->Paint(skia_canvas_.get(), normalized_rect);
|
| + }
|
|
|
| // The mac coordinate system is flipped vertical from the normal skia
|
| // coordinates. During painting of the frame, flip the coordinates
|
| @@ -705,6 +730,7 @@ void WebMediaPlayerImpl::OnPipelineSeek() {
|
| }
|
|
|
| SetReadyState(WebKit::WebMediaPlayer::HaveEnoughData);
|
| + seeking_ = false;
|
| GetClient()->timeChanged();
|
| }
|
| }
|
|
|