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 // 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 Loading... |
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 } |
OLD | NEW |