OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/video_track_adapter.h" | 5 #include "content/renderer/media/video_track_adapter.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/location.h" | 13 #include "base/location.h" |
| 14 #include "base/macros.h" |
14 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
15 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
16 #include "base/trace_event/trace_event.h" | 17 #include "base/trace_event/trace_event.h" |
17 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
18 #include "media/base/bind_to_current_loop.h" | 19 #include "media/base/bind_to_current_loop.h" |
19 #include "media/base/video_util.h" | 20 #include "media/base/video_util.h" |
20 | 21 |
21 namespace content { | 22 namespace content { |
22 | 23 |
23 namespace { | 24 namespace { |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 base::TimeTicks estimated_capture_time) { | 484 base::TimeTicks estimated_capture_time) { |
484 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 485 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
485 TRACE_EVENT0("video", "VideoTrackAdapter::DeliverFrameOnIO"); | 486 TRACE_EVENT0("video", "VideoTrackAdapter::DeliverFrameOnIO"); |
486 ++frame_counter_; | 487 ++frame_counter_; |
487 for (const auto& adapter : adapters_) | 488 for (const auto& adapter : adapters_) |
488 adapter->DeliverFrame(frame, estimated_capture_time); | 489 adapter->DeliverFrame(frame, estimated_capture_time); |
489 } | 490 } |
490 | 491 |
491 void VideoTrackAdapter::CheckFramesReceivedOnIO( | 492 void VideoTrackAdapter::CheckFramesReceivedOnIO( |
492 const OnMutedCallback& set_muted_state_callback, | 493 const OnMutedCallback& set_muted_state_callback, |
493 uint64 old_frame_counter_snapshot) { | 494 uint64_t old_frame_counter_snapshot) { |
494 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 495 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
495 | 496 |
496 if (!monitoring_frame_rate_) | 497 if (!monitoring_frame_rate_) |
497 return; | 498 return; |
498 | 499 |
499 DVLOG_IF(1, old_frame_counter_snapshot == frame_counter_) | 500 DVLOG_IF(1, old_frame_counter_snapshot == frame_counter_) |
500 << "No frames have passed, setting source as Muted."; | 501 << "No frames have passed, setting source as Muted."; |
501 | 502 |
502 bool muted_state = old_frame_counter_snapshot == frame_counter_; | 503 bool muted_state = old_frame_counter_snapshot == frame_counter_; |
503 if (muted_state_ != muted_state) { | 504 if (muted_state_ != muted_state) { |
504 set_muted_state_callback.Run(muted_state); | 505 set_muted_state_callback.Run(muted_state); |
505 muted_state_ = muted_state; | 506 muted_state_ = muted_state; |
506 } | 507 } |
507 | 508 |
508 io_task_runner_->PostDelayedTask( | 509 io_task_runner_->PostDelayedTask( |
509 FROM_HERE, base::Bind(&VideoTrackAdapter::CheckFramesReceivedOnIO, this, | 510 FROM_HERE, base::Bind(&VideoTrackAdapter::CheckFramesReceivedOnIO, this, |
510 set_muted_state_callback, frame_counter_), | 511 set_muted_state_callback, frame_counter_), |
511 base::TimeDelta::FromSecondsD(kNormalFrameTimeoutInFrameIntervals / | 512 base::TimeDelta::FromSecondsD(kNormalFrameTimeoutInFrameIntervals / |
512 source_frame_rate_)); | 513 source_frame_rate_)); |
513 } | 514 } |
514 | 515 |
515 } // namespace content | 516 } // namespace content |
OLD | NEW |