OLD | NEW |
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 "chrome/renderer/media/cast_transport_sender_ipc.h" | 5 #include "chrome/renderer/media/cast_transport_sender_ipc.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/id_map.h" | 8 #include "base/id_map.h" |
9 #include "chrome/common/cast_messages.h" | 9 #include "chrome/common/cast_messages.h" |
10 #include "chrome/renderer/media/cast_ipc_dispatcher.h" | 10 #include "chrome/renderer/media/cast_ipc_dispatcher.h" |
11 #include "ipc/ipc_channel_proxy.h" | 11 #include "ipc/ipc_channel_proxy.h" |
12 #include "media/cast/cast_sender.h" | 12 #include "media/cast/cast_sender.h" |
13 #include "media/cast/transport/cast_transport_sender.h" | 13 #include "media/cast/transport/cast_transport_sender.h" |
14 | 14 |
15 CastTransportSenderIPC::CastTransportSenderIPC( | 15 CastTransportSenderIPC::CastTransportSenderIPC( |
16 const media::cast::transport::CastTransportConfig& config, | 16 const media::cast::transport::CastTransportConfig& config, |
17 const media::cast::transport::CastTransportStatusCallback& status_cb) | 17 const media::cast::transport::CastTransportStatusCallback& status_cb, |
18 : status_callback_(status_cb) { | 18 const media::cast::transport::BulkRawEventsCallback& raw_events_cb) |
| 19 : status_callback_(status_cb), raw_events_callback_(raw_events_cb) { |
19 if (CastIPCDispatcher::Get()) { | 20 if (CastIPCDispatcher::Get()) { |
20 channel_id_ = CastIPCDispatcher::Get()->AddSender(this); | 21 channel_id_ = CastIPCDispatcher::Get()->AddSender(this); |
21 } | 22 } |
22 Send(new CastHostMsg_New(channel_id_, config)); | 23 Send(new CastHostMsg_New(channel_id_, config)); |
23 } | 24 } |
24 | 25 |
25 CastTransportSenderIPC::~CastTransportSenderIPC() { | 26 CastTransportSenderIPC::~CastTransportSenderIPC() { |
26 Send(new CastHostMsg_Delete(channel_id_)); | 27 Send(new CastHostMsg_Delete(channel_id_)); |
27 if (CastIPCDispatcher::Get()) { | 28 if (CastIPCDispatcher::Get()) { |
28 CastIPCDispatcher::Get()->RemoveSender(channel_id_); | 29 CastIPCDispatcher::Get()->RemoveSender(channel_id_); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 void CastTransportSenderIPC::OnRtpStatistics( | 110 void CastTransportSenderIPC::OnRtpStatistics( |
110 bool audio, | 111 bool audio, |
111 const media::cast::transport::RtcpSenderInfo& sender_info, | 112 const media::cast::transport::RtcpSenderInfo& sender_info, |
112 base::TimeTicks time_sent, | 113 base::TimeTicks time_sent, |
113 uint32 rtp_timestamp) { | 114 uint32 rtp_timestamp) { |
114 const media::cast::transport::CastTransportRtpStatistics& callback = | 115 const media::cast::transport::CastTransportRtpStatistics& callback = |
115 audio ? audio_rtp_callback_ : video_rtp_callback_; | 116 audio ? audio_rtp_callback_ : video_rtp_callback_; |
116 callback.Run(sender_info, time_sent, rtp_timestamp); | 117 callback.Run(sender_info, time_sent, rtp_timestamp); |
117 } | 118 } |
118 | 119 |
| 120 void CastTransportSenderIPC::OnRawEvents( |
| 121 const std::vector<media::cast::PacketEvent>& packet_events) { |
| 122 raw_events_callback_.Run(packet_events); |
| 123 } |
| 124 |
119 void CastTransportSenderIPC::Send(IPC::Message* message) { | 125 void CastTransportSenderIPC::Send(IPC::Message* message) { |
120 if (CastIPCDispatcher::Get()) { | 126 if (CastIPCDispatcher::Get()) { |
121 CastIPCDispatcher::Get()->Send(message); | 127 CastIPCDispatcher::Get()->Send(message); |
122 } else { | 128 } else { |
123 delete message; | 129 delete message; |
124 } | 130 } |
125 } | 131 } |
OLD | NEW |