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 "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 Loading... | |
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 if (!base::Time::ActivateHighResolutionTimer(true)) { | |
miu
2015/05/07 20:04:34
nit: This led me to think this only provides bette
| |
42 LOG(WARNING) << "Failed to activate high resolution timers for cast."; | |
43 } | |
44 #endif | |
40 } | 45 } |
41 | 46 |
42 CastSessionDelegateBase::~CastSessionDelegateBase() { | 47 CastSessionDelegateBase::~CastSessionDelegateBase() { |
43 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 48 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
49 #if defined(OS_WIN) | |
50 base::Time::ActivateHighResolutionTimer(false); | |
51 #endif | |
44 } | 52 } |
45 | 53 |
46 void CastSessionDelegateBase::StartUDP( | 54 void CastSessionDelegateBase::StartUDP( |
47 const net::IPEndPoint& local_endpoint, | 55 const net::IPEndPoint& local_endpoint, |
48 const net::IPEndPoint& remote_endpoint, | 56 const net::IPEndPoint& remote_endpoint, |
49 scoped_ptr<base::DictionaryValue> options, | 57 scoped_ptr<base::DictionaryValue> options, |
50 const ErrorCallback& error_callback) { | 58 const ErrorCallback& error_callback) { |
51 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 59 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
52 | 60 |
53 // CastSender uses the renderer's IO thread as the main thread. This reduces | 61 // 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 Loading... | |
338 } else { | 346 } else { |
339 cast_environment_->Logging()->InsertFrameEvent( | 347 cast_environment_->Logging()->InsertFrameEvent( |
340 it->timestamp, | 348 it->timestamp, |
341 it->type, | 349 it->type, |
342 it->media_type, | 350 it->media_type, |
343 it->rtp_timestamp, | 351 it->rtp_timestamp, |
344 it->frame_id); | 352 it->frame_id); |
345 } | 353 } |
346 } | 354 } |
347 } | 355 } |
OLD | NEW |