| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/media/webmediaplayer_ms.h" | 5 #include "content/renderer/media/webmediaplayer_ms.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 audio_renderer_->Pause(); | 203 audio_renderer_->Pause(); |
| 204 | 204 |
| 205 if (delegate_.get()) | 205 if (delegate_.get()) |
| 206 delegate_->DidPause(this); | 206 delegate_->DidPause(this); |
| 207 } | 207 } |
| 208 | 208 |
| 209 paused_ = true; | 209 paused_ = true; |
| 210 | 210 |
| 211 media_log_->AddEvent(media_log_->CreateEvent(media::MediaLogEvent::PAUSE)); | 211 media_log_->AddEvent(media_log_->CreateEvent(media::MediaLogEvent::PAUSE)); |
| 212 | 212 |
| 213 if (!current_frame_) | 213 if (!current_frame_.get()) |
| 214 return; | 214 return; |
| 215 | 215 |
| 216 // Copy the frame so that rendering can show the last received frame. | 216 // Copy the frame so that rendering can show the last received frame. |
| 217 // The original frame must not be referenced when the player is paused since | 217 // The original frame must not be referenced when the player is paused since |
| 218 // there might be a finite number of available buffers. E.g, video that | 218 // there might be a finite number of available buffers. E.g, video that |
| 219 // originates from a video camera. | 219 // originates from a video camera. |
| 220 scoped_refptr<media::VideoFrame> new_frame = CopyFrameToYV12(current_frame_); | 220 scoped_refptr<media::VideoFrame> new_frame = CopyFrameToYV12(current_frame_); |
| 221 base::AutoLock auto_lock(current_frame_lock_); | 221 base::AutoLock auto_lock(current_frame_lock_); |
| 222 current_frame_ = new_frame; | 222 current_frame_ = new_frame; |
| 223 } | 223 } |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 received_first_frame_ = true; | 421 received_first_frame_ = true; |
| 422 { | 422 { |
| 423 base::AutoLock auto_lock(current_frame_lock_); | 423 base::AutoLock auto_lock(current_frame_lock_); |
| 424 DCHECK(!current_frame_used_); | 424 DCHECK(!current_frame_used_); |
| 425 current_frame_ = frame; | 425 current_frame_ = frame; |
| 426 } | 426 } |
| 427 SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata); | 427 SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata); |
| 428 SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData); | 428 SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData); |
| 429 GetClient()->sizeChanged(); | 429 GetClient()->sizeChanged(); |
| 430 | 430 |
| 431 if (video_frame_provider_) { | 431 if (video_frame_provider_.get()) { |
| 432 video_weblayer_.reset(new cc_blink::WebLayerImpl( | 432 video_weblayer_.reset(new cc_blink::WebLayerImpl( |
| 433 cc::VideoLayer::Create(this, media::VIDEO_ROTATION_0))); | 433 cc::VideoLayer::Create(this, media::VIDEO_ROTATION_0))); |
| 434 video_weblayer_->setOpaque(true); | 434 video_weblayer_->setOpaque(true); |
| 435 GetClient()->setWebLayer(video_weblayer_.get()); | 435 GetClient()->setWebLayer(video_weblayer_.get()); |
| 436 } | 436 } |
| 437 } | 437 } |
| 438 | 438 |
| 439 // Do not update |current_frame_| when paused. | 439 // Do not update |current_frame_| when paused. |
| 440 if (paused_) | 440 if (paused_) |
| 441 return; | 441 return; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 GetClient()->readyStateChanged(); | 485 GetClient()->readyStateChanged(); |
| 486 } | 486 } |
| 487 | 487 |
| 488 blink::WebMediaPlayerClient* WebMediaPlayerMS::GetClient() { | 488 blink::WebMediaPlayerClient* WebMediaPlayerMS::GetClient() { |
| 489 DCHECK(thread_checker_.CalledOnValidThread()); | 489 DCHECK(thread_checker_.CalledOnValidThread()); |
| 490 DCHECK(client_); | 490 DCHECK(client_); |
| 491 return client_; | 491 return client_; |
| 492 } | 492 } |
| 493 | 493 |
| 494 } // namespace content | 494 } // namespace content |
| OLD | NEW |