Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: content/renderer/media/video_track_adapter.cc

Issue 1083883003: Move BindToCurrentLoop from media/base/ to base/ Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix media/base/callback_holder.h compile Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/bind_to_current_loop.h"
12 #include "base/command_line.h" 13 #include "base/command_line.h"
13 #include "base/location.h" 14 #include "base/location.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/video_util.h" 19 #include "media/base/video_util.h"
20 20
21 namespace content { 21 namespace content {
22 22
23 namespace { 23 namespace {
24 24
25 // Amount of frame intervals to wait before considering the source as muted, for 25 // Amount of frame intervals to wait before considering the source as muted, for
26 // the first frame and under normal conditions, respectively. First frame might 26 // the first frame and under normal conditions, respectively. First frame might
27 // take longer to arrive due to source startup. 27 // take longer to arrive due to source startup.
28 const float kFirstFrameTimeoutInFrameIntervals = 100.0f; 28 const float kFirstFrameTimeoutInFrameIntervals = 100.0f;
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 FROM_HERE, 421 FROM_HERE,
422 base::Bind(&VideoTrackAdapter::RemoveTrackOnIO, this, track)); 422 base::Bind(&VideoTrackAdapter::RemoveTrackOnIO, this, track));
423 } 423 }
424 424
425 void VideoTrackAdapter::StartFrameMonitoring( 425 void VideoTrackAdapter::StartFrameMonitoring(
426 double source_frame_rate, 426 double source_frame_rate,
427 const OnMutedCallback& on_muted_callback) { 427 const OnMutedCallback& on_muted_callback) {
428 DCHECK(thread_checker_.CalledOnValidThread()); 428 DCHECK(thread_checker_.CalledOnValidThread());
429 429
430 VideoTrackAdapter::OnMutedCallback bound_on_muted_callback = 430 VideoTrackAdapter::OnMutedCallback bound_on_muted_callback =
431 media::BindToCurrentLoop(on_muted_callback); 431 base::BindToCurrentLoop(on_muted_callback);
432 432
433 io_message_loop_->PostTask( 433 io_message_loop_->PostTask(
434 FROM_HERE, 434 FROM_HERE,
435 base::Bind(&VideoTrackAdapter::StartFrameMonitoringOnIO, 435 base::Bind(&VideoTrackAdapter::StartFrameMonitoringOnIO,
436 this, bound_on_muted_callback, source_frame_rate)); 436 this, bound_on_muted_callback, source_frame_rate));
437 } 437 }
438 438
439 void VideoTrackAdapter::StopFrameMonitoring() { 439 void VideoTrackAdapter::StopFrameMonitoring() {
440 DCHECK(thread_checker_.CalledOnValidThread()); 440 DCHECK(thread_checker_.CalledOnValidThread());
441 io_message_loop_->PostTask( 441 io_message_loop_->PostTask(
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 } 509 }
510 510
511 io_message_loop_->PostDelayedTask(FROM_HERE, 511 io_message_loop_->PostDelayedTask(FROM_HERE,
512 base::Bind(&VideoTrackAdapter::CheckFramesReceivedOnIO, this, 512 base::Bind(&VideoTrackAdapter::CheckFramesReceivedOnIO, this,
513 set_muted_state_callback, frame_counter_), 513 set_muted_state_callback, frame_counter_),
514 base::TimeDelta::FromSecondsD(kNormalFrameTimeoutInFrameIntervals / 514 base::TimeDelta::FromSecondsD(kNormalFrameTimeoutInFrameIntervals /
515 source_frame_rate_)); 515 source_frame_rate_));
516 } 516 }
517 517
518 } // namespace content 518 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/video_source_handler.cc ('k') | content/renderer/media/webrtc/media_stream_remote_video_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698