| 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::CastLoggingConfig& logging_config, |
| 18 : status_callback_(status_cb) { | 18 const media::cast::transport::CastTransportStatusCallback& status_cb, |
| 19 const media::cast::transport::BulkRawEventsCallback& raw_events_cb) |
| 20 : status_callback_(status_cb), raw_events_callback_(raw_events_cb) { |
| 19 if (CastIPCDispatcher::Get()) { | 21 if (CastIPCDispatcher::Get()) { |
| 20 channel_id_ = CastIPCDispatcher::Get()->AddSender(this); | 22 channel_id_ = CastIPCDispatcher::Get()->AddSender(this); |
| 21 } | 23 } |
| 22 Send(new CastHostMsg_New(channel_id_, config)); | 24 Send(new CastHostMsg_New(channel_id_, config, logging_config)); |
| 23 } | 25 } |
| 24 | 26 |
| 25 CastTransportSenderIPC::~CastTransportSenderIPC() { | 27 CastTransportSenderIPC::~CastTransportSenderIPC() { |
| 26 Send(new CastHostMsg_Delete(channel_id_)); | 28 Send(new CastHostMsg_Delete(channel_id_)); |
| 27 if (CastIPCDispatcher::Get()) { | 29 if (CastIPCDispatcher::Get()) { |
| 28 CastIPCDispatcher::Get()->RemoveSender(channel_id_); | 30 CastIPCDispatcher::Get()->RemoveSender(channel_id_); |
| 29 } | 31 } |
| 30 } | 32 } |
| 31 | 33 |
| 32 void CastTransportSenderIPC::SetPacketReceiver( | 34 void CastTransportSenderIPC::SetPacketReceiver( |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 void CastTransportSenderIPC::OnRtpStatistics( | 111 void CastTransportSenderIPC::OnRtpStatistics( |
| 110 bool audio, | 112 bool audio, |
| 111 const media::cast::transport::RtcpSenderInfo& sender_info, | 113 const media::cast::transport::RtcpSenderInfo& sender_info, |
| 112 base::TimeTicks time_sent, | 114 base::TimeTicks time_sent, |
| 113 uint32 rtp_timestamp) { | 115 uint32 rtp_timestamp) { |
| 114 const media::cast::transport::CastTransportRtpStatistics& callback = | 116 const media::cast::transport::CastTransportRtpStatistics& callback = |
| 115 audio ? audio_rtp_callback_ : video_rtp_callback_; | 117 audio ? audio_rtp_callback_ : video_rtp_callback_; |
| 116 callback.Run(sender_info, time_sent, rtp_timestamp); | 118 callback.Run(sender_info, time_sent, rtp_timestamp); |
| 117 } | 119 } |
| 118 | 120 |
| 121 void CastTransportSenderIPC::OnRawEvents( |
| 122 const std::vector<media::cast::PacketEvent>& packet_events) { |
| 123 raw_events_callback_.Run(packet_events); |
| 124 } |
| 125 |
| 119 void CastTransportSenderIPC::Send(IPC::Message* message) { | 126 void CastTransportSenderIPC::Send(IPC::Message* message) { |
| 120 if (CastIPCDispatcher::Get()) { | 127 if (CastIPCDispatcher::Get()) { |
| 121 CastIPCDispatcher::Get()->Send(message); | 128 CastIPCDispatcher::Get()->Send(message); |
| 122 } else { | 129 } else { |
| 123 delete message; | 130 delete message; |
| 124 } | 131 } |
| 125 } | 132 } |
| OLD | NEW |