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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
444 return true; | 444 return true; |
445 } | 445 } |
446 | 446 |
447 void WebMediaPlayerMS::SetVideoFrameProviderClient( | 447 void WebMediaPlayerMS::SetVideoFrameProviderClient( |
448 cc::VideoFrameProvider::Client* client) { | 448 cc::VideoFrameProvider::Client* client) { |
449 // This is called from both the main renderer thread and the compositor | 449 // This is called from both the main renderer thread and the compositor |
450 // thread (when the main thread is blocked). | 450 // thread (when the main thread is blocked). |
451 if (video_frame_provider_client_) | 451 if (video_frame_provider_client_) |
452 video_frame_provider_client_->StopUsingProvider(); | 452 video_frame_provider_client_->StopUsingProvider(); |
453 video_frame_provider_client_ = client; | 453 video_frame_provider_client_ = client; |
454 if (client) { | |
455 client->StartRendering(); | |
456 } | |
mcasas
2015/07/30 08:40:24
no need for {}
qiangchen
2015/07/30 17:40:26
Done.
| |
454 } | 457 } |
455 | 458 |
456 bool WebMediaPlayerMS::UpdateCurrentFrame(base::TimeTicks deadline_min, | 459 bool WebMediaPlayerMS::UpdateCurrentFrame(base::TimeTicks deadline_min, |
457 base::TimeTicks deadline_max) { | 460 base::TimeTicks deadline_max) { |
mcasas
2015/07/30 08:40:24
Suggestion: change base::TimeTicks to base::TimeDe
DaleCurtis
2015/07/30 16:26:04
These are values forwarded from the compositor Beg
qiangchen
2015/07/30 17:40:26
Did you mean deadline_min and deadline_max?
Updat
mcasas
2015/07/31 08:41:31
Yes, it would mean changing base class and derived
DaleCurtis
2015/07/31 16:05:07
TimeTicks is the correct usage here since these va
| |
461 TRACE_EVENT_BEGIN2("webrtc", "WebMediaPlayerMS::UpdateCurrentFrame", | |
462 "Actual Render Begin", deadline_min.ToInternalValue(), | |
463 "Actual Render End", deadline_max.ToInternalValue()); | |
464 | |
458 // TODO(dalecurtis): This should make use of the deadline interval to ensure | 465 // TODO(dalecurtis): This should make use of the deadline interval to ensure |
459 // the painted frame is correct for the given interval. | 466 // the painted frame is correct for the given interval. |
460 NOTREACHED(); | 467 |
461 return false; | 468 base::TimeTicks render_time = current_frame_->render_time(); |
mcasas
2015/07/30 08:40:24
const
qiangchen
2015/07/30 17:40:26
Done.
qiangchen
2015/07/31 17:15:33
N/A
| |
469 TRACE_EVENT_END1("webrtc", "WebMediaPlayerMS::UpdateCurrentFrame", | |
470 "Ideal Render Instant", render_time.ToInternalValue()); | |
471 return !current_frame_used_; | |
462 } | 472 } |
463 | 473 |
464 bool WebMediaPlayerMS::HasCurrentFrame() { | 474 bool WebMediaPlayerMS::HasCurrentFrame() { |
465 base::AutoLock auto_lock(current_frame_lock_); | 475 base::AutoLock auto_lock(current_frame_lock_); |
466 return current_frame_; | 476 return current_frame_; |
467 } | 477 } |
468 | 478 |
469 scoped_refptr<media::VideoFrame> WebMediaPlayerMS::GetCurrentFrame() { | 479 scoped_refptr<media::VideoFrame> WebMediaPlayerMS::GetCurrentFrame() { |
470 DVLOG(3) << "WebMediaPlayerMS::GetCurrentFrame"; | 480 DVLOG(3) << "WebMediaPlayerMS::GetCurrentFrame"; |
471 base::AutoLock auto_lock(current_frame_lock_); | 481 base::AutoLock auto_lock(current_frame_lock_); |
472 if (!current_frame_.get()) | 482 if (!current_frame_.get()) |
473 return NULL; | 483 return NULL; |
474 current_frame_used_ = true; | 484 current_frame_used_ = true; |
475 return current_frame_; | 485 return current_frame_; |
476 } | 486 } |
477 | 487 |
478 void WebMediaPlayerMS::PutCurrentFrame() { | 488 void WebMediaPlayerMS::PutCurrentFrame() { |
479 DVLOG(3) << "WebMediaPlayerMS::PutCurrentFrame"; | 489 DVLOG(3) << "WebMediaPlayerMS::PutCurrentFrame"; |
480 } | 490 } |
481 | 491 |
482 void WebMediaPlayerMS::OnFrameAvailable( | 492 void WebMediaPlayerMS::OnFrameAvailable( |
483 const scoped_refptr<media::VideoFrame>& frame) { | 493 const scoped_refptr<media::VideoFrame>& frame) { |
484 DVLOG(3) << "WebMediaPlayerMS::OnFrameAvailable"; | 494 DVLOG(3) << "WebMediaPlayerMS::OnFrameAvailable"; |
485 DCHECK(thread_checker_.CalledOnValidThread()); | 495 DCHECK(thread_checker_.CalledOnValidThread()); |
496 | |
497 TRACE_EVENT1("webrtc", "WebMediaPlayerMS::OnFrameAvailable", | |
498 "Ideal Render Instant", frame->render_time().ToInternalValue()); | |
499 | |
486 ++total_frame_count_; | 500 ++total_frame_count_; |
487 if (!received_first_frame_) { | 501 if (!received_first_frame_) { |
488 received_first_frame_ = true; | 502 received_first_frame_ = true; |
489 { | 503 { |
490 base::AutoLock auto_lock(current_frame_lock_); | 504 base::AutoLock auto_lock(current_frame_lock_); |
491 DCHECK(!current_frame_used_); | 505 DCHECK(!current_frame_used_); |
492 current_frame_ = frame; | 506 current_frame_ = frame; |
493 } | 507 } |
494 SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata); | 508 SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata); |
495 SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData); | 509 SetReadyState(WebMediaPlayer::ReadyStateHaveEnoughData); |
(...skipping 19 matching lines...) Expand all Loading... | |
515 base::AutoLock auto_lock(current_frame_lock_); | 529 base::AutoLock auto_lock(current_frame_lock_); |
516 if (!current_frame_used_ && current_frame_.get()) | 530 if (!current_frame_used_ && current_frame_.get()) |
517 ++dropped_frame_count_; | 531 ++dropped_frame_count_; |
518 current_frame_ = frame; | 532 current_frame_ = frame; |
519 current_time_ = frame->timestamp(); | 533 current_time_ = frame->timestamp(); |
520 current_frame_used_ = false; | 534 current_frame_used_ = false; |
521 } | 535 } |
522 | 536 |
523 if (size_changed) | 537 if (size_changed) |
524 GetClient()->sizeChanged(); | 538 GetClient()->sizeChanged(); |
525 | |
526 GetClient()->repaint(); | |
527 } | 539 } |
528 | 540 |
529 void WebMediaPlayerMS::RepaintInternal() { | 541 void WebMediaPlayerMS::RepaintInternal() { |
530 DVLOG(1) << "WebMediaPlayerMS::RepaintInternal"; | 542 DVLOG(1) << "WebMediaPlayerMS::RepaintInternal"; |
531 DCHECK(thread_checker_.CalledOnValidThread()); | 543 DCHECK(thread_checker_.CalledOnValidThread()); |
532 GetClient()->repaint(); | 544 GetClient()->repaint(); |
533 } | 545 } |
534 | 546 |
535 void WebMediaPlayerMS::OnSourceError() { | 547 void WebMediaPlayerMS::OnSourceError() { |
536 DVLOG(1) << "WebMediaPlayerMS::OnSourceError"; | 548 DVLOG(1) << "WebMediaPlayerMS::OnSourceError"; |
(...skipping 16 matching lines...) Expand all Loading... | |
553 GetClient()->readyStateChanged(); | 565 GetClient()->readyStateChanged(); |
554 } | 566 } |
555 | 567 |
556 blink::WebMediaPlayerClient* WebMediaPlayerMS::GetClient() { | 568 blink::WebMediaPlayerClient* WebMediaPlayerMS::GetClient() { |
557 DCHECK(thread_checker_.CalledOnValidThread()); | 569 DCHECK(thread_checker_.CalledOnValidThread()); |
558 DCHECK(client_); | 570 DCHECK(client_); |
559 return client_; | 571 return client_; |
560 } | 572 } |
561 | 573 |
562 } // namespace content | 574 } // namespace content |
OLD | NEW |