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

Side by Side Diff: chrome/renderer/media/cast_session_delegate.cc

Issue 1126873002: Cast: Enable high-resolution timers while casting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment added Created 5 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/renderer/media/cast_session_delegate.h" 5 #include "chrome/renderer/media/cast_session_delegate.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 19 matching lines...) Expand all
30 using media::cast::VideoSenderConfig; 30 using media::cast::VideoSenderConfig;
31 31
32 static base::LazyInstance<CastThreads> g_cast_threads = 32 static base::LazyInstance<CastThreads> g_cast_threads =
33 LAZY_INSTANCE_INITIALIZER; 33 LAZY_INSTANCE_INITIALIZER;
34 34
35 CastSessionDelegateBase::CastSessionDelegateBase() 35 CastSessionDelegateBase::CastSessionDelegateBase()
36 : io_task_runner_( 36 : io_task_runner_(
37 content::RenderThread::Get()->GetIOMessageLoopProxy()), 37 content::RenderThread::Get()->GetIOMessageLoopProxy()),
38 weak_factory_(this) { 38 weak_factory_(this) {
39 DCHECK(io_task_runner_.get()); 39 DCHECK(io_task_runner_.get());
40 #if defined(OS_WIN)
41 // Note that this also increases the accuracy of PostDelayTask,
42 // which is is very helpful to cast.
43 if (!base::Time::ActivateHighResolutionTimer(true)) {
44 LOG(WARNING) << "Failed to activate high resolution timers for cast.";
45 }
46 #endif
40 } 47 }
41 48
42 CastSessionDelegateBase::~CastSessionDelegateBase() { 49 CastSessionDelegateBase::~CastSessionDelegateBase() {
43 DCHECK(io_task_runner_->BelongsToCurrentThread()); 50 DCHECK(io_task_runner_->BelongsToCurrentThread());
51 #if defined(OS_WIN)
52 base::Time::ActivateHighResolutionTimer(false);
53 #endif
44 } 54 }
45 55
46 void CastSessionDelegateBase::StartUDP( 56 void CastSessionDelegateBase::StartUDP(
47 const net::IPEndPoint& local_endpoint, 57 const net::IPEndPoint& local_endpoint,
48 const net::IPEndPoint& remote_endpoint, 58 const net::IPEndPoint& remote_endpoint,
49 scoped_ptr<base::DictionaryValue> options, 59 scoped_ptr<base::DictionaryValue> options,
50 const ErrorCallback& error_callback) { 60 const ErrorCallback& error_callback) {
51 DCHECK(io_task_runner_->BelongsToCurrentThread()); 61 DCHECK(io_task_runner_->BelongsToCurrentThread());
52 62
53 // CastSender uses the renderer's IO thread as the main thread. This reduces 63 // CastSender uses the renderer's IO thread as the main thread. This reduces
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 } else { 348 } else {
339 cast_environment_->Logging()->InsertFrameEvent( 349 cast_environment_->Logging()->InsertFrameEvent(
340 it->timestamp, 350 it->timestamp,
341 it->type, 351 it->type,
342 it->media_type, 352 it->media_type,
343 it->rtp_timestamp, 353 it->rtp_timestamp,
344 it->frame_id); 354 it->frame_id);
345 } 355 }
346 } 356 }
347 } 357 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698