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/message_loop/message_loop_proxy.h" | |
11 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "base/thread_task_runner_handle.h" |
12 #include "chrome/common/chrome_version_info.h" | 12 #include "chrome/common/chrome_version_info.h" |
13 #include "chrome/renderer/media/cast_threads.h" | 13 #include "chrome/renderer/media/cast_threads.h" |
14 #include "chrome/renderer/media/cast_transport_sender_ipc.h" | 14 #include "chrome/renderer/media/cast_transport_sender_ipc.h" |
15 #include "content/public/renderer/render_thread.h" | 15 #include "content/public/renderer/render_thread.h" |
16 #include "media/cast/cast_config.h" | 16 #include "media/cast/cast_config.h" |
17 #include "media/cast/cast_environment.h" | 17 #include "media/cast/cast_environment.h" |
18 #include "media/cast/cast_sender.h" | 18 #include "media/cast/cast_sender.h" |
19 #include "media/cast/logging/log_serializer.h" | 19 #include "media/cast/logging/log_serializer.h" |
20 #include "media/cast/logging/logging_defines.h" | 20 #include "media/cast/logging/logging_defines.h" |
21 #include "media/cast/logging/proto/raw_events.pb.h" | 21 #include "media/cast/logging/proto/raw_events.pb.h" |
(...skipping 25 matching lines...) Expand all Loading... |
47 const net::IPEndPoint& remote_endpoint, | 47 const net::IPEndPoint& remote_endpoint, |
48 scoped_ptr<base::DictionaryValue> options, | 48 scoped_ptr<base::DictionaryValue> options, |
49 const ErrorCallback& error_callback) { | 49 const ErrorCallback& error_callback) { |
50 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); | 50 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); |
51 | 51 |
52 // CastSender uses the renderer's IO thread as the main thread. This reduces | 52 // CastSender uses the renderer's IO thread as the main thread. This reduces |
53 // thread hopping for incoming video frames and outgoing network packets. | 53 // thread hopping for incoming video frames and outgoing network packets. |
54 // TODO(hubbe): Create cast environment in ctor instead. | 54 // TODO(hubbe): Create cast environment in ctor instead. |
55 cast_environment_ = new CastEnvironment( | 55 cast_environment_ = new CastEnvironment( |
56 scoped_ptr<base::TickClock>(new base::DefaultTickClock()).Pass(), | 56 scoped_ptr<base::TickClock>(new base::DefaultTickClock()).Pass(), |
57 base::MessageLoopProxy::current(), | 57 base::ThreadTaskRunnerHandle::Get(), |
58 g_cast_threads.Get().GetAudioEncodeMessageLoopProxy(), | 58 g_cast_threads.Get().GetAudioEncodeMessageLoopProxy(), |
59 g_cast_threads.Get().GetVideoEncodeMessageLoopProxy()); | 59 g_cast_threads.Get().GetVideoEncodeMessageLoopProxy()); |
60 | 60 |
61 // Rationale for using unretained: The callback cannot be called after the | 61 // Rationale for using unretained: The callback cannot be called after the |
62 // destruction of CastTransportSenderIPC, and they both share the same thread. | 62 // destruction of CastTransportSenderIPC, and they both share the same thread. |
63 cast_transport_.reset(new CastTransportSenderIPC( | 63 cast_transport_.reset(new CastTransportSenderIPC( |
64 local_endpoint, | 64 local_endpoint, |
65 remote_endpoint, | 65 remote_endpoint, |
66 options.Pass(), | 66 options.Pass(), |
67 base::Bind(&CastSessionDelegateBase::ReceivePacket, | 67 base::Bind(&CastSessionDelegateBase::ReceivePacket, |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 } else { | 337 } else { |
338 cast_environment_->Logging()->InsertFrameEvent( | 338 cast_environment_->Logging()->InsertFrameEvent( |
339 it->timestamp, | 339 it->timestamp, |
340 it->type, | 340 it->type, |
341 it->media_type, | 341 it->media_type, |
342 it->rtp_timestamp, | 342 it->rtp_timestamp, |
343 it->frame_id); | 343 it->frame_id); |
344 } | 344 } |
345 } | 345 } |
346 } | 346 } |
OLD | NEW |