Index: chrome/renderer/media/cast_transport_sender_ipc.cc |
diff --git a/chrome/renderer/media/cast_transport_sender_ipc.cc b/chrome/renderer/media/cast_transport_sender_ipc.cc |
index 4f438978c37b70f4ffc718097ad22908a2eea652..e814dc26effc774919508aec582540aa51d429af 100644 |
--- a/chrome/renderer/media/cast_transport_sender_ipc.cc |
+++ b/chrome/renderer/media/cast_transport_sender_ipc.cc |
@@ -15,15 +15,22 @@ CastTransportSenderIPC::ClientCallbacks::ClientCallbacks() {} |
CastTransportSenderIPC::ClientCallbacks::~ClientCallbacks() {} |
CastTransportSenderIPC::CastTransportSenderIPC( |
+ const net::IPEndPoint& local_end_point, |
const net::IPEndPoint& remote_end_point, |
scoped_ptr<base::DictionaryValue> options, |
+ const media::cast::PacketReceiverCallback& packet_callback, |
const media::cast::CastTransportStatusCallback& status_cb, |
const media::cast::BulkRawEventsCallback& raw_events_cb) |
- : status_callback_(status_cb), raw_events_callback_(raw_events_cb) { |
+ : packet_callback_(packet_callback) , |
+ status_callback_(status_cb), |
+ raw_events_callback_(raw_events_cb) { |
if (CastIPCDispatcher::Get()) { |
channel_id_ = CastIPCDispatcher::Get()->AddSender(this); |
} |
- Send(new CastHostMsg_New(channel_id_, remote_end_point, *options)); |
+ Send(new CastHostMsg_New(channel_id_, |
+ local_end_point, |
+ remote_end_point, |
+ *options)); |
} |
CastTransportSenderIPC::~CastTransportSenderIPC() { |
@@ -80,6 +87,53 @@ void CastTransportSenderIPC::ResendFrameForKickstart( |
frame_id)); |
} |
+void CastTransportSenderIPC::AddValidSsrc(uint32 ssrc) { |
+ Send(new CastHostMsg_AddValidSsrc(channel_id_, ssrc)); |
+} |
+ |
+ |
Tom Sepez
2014/12/10 23:52:57
nit: extra blank line.
hubbe
2014/12/11 00:10:32
Done.
|
+void CastTransportSenderIPC::SendRtcpFromRtpReceiver( |
+ uint32 ssrc, |
+ uint32 sender_ssrc, |
+ const media::cast::RtcpTimeData& time_data, |
+ const media::cast::RtcpCastMessage* cast_message, |
+ base::TimeDelta target_delay, |
+ const media::cast::ReceiverRtcpEventSubscriber::RtcpEvents* |
+ rtcp_events, |
+ const media::cast::RtpReceiverStatistics* rtp_receiver_statistics) { |
+ // To avoid copies, we put pointers to objects we don't really |
Tom Sepez
2014/12/10 23:52:57
Sounds dangerous, can we avoid this?
hubbe
2014/12/11 00:10:32
The only way I see to avoid it is to actually copy
|
+ // own into scoped pointers and then very carefully extract them again |
+ // before the scoped pointers go out of scope. |
+ media::cast::SendRtcpFromRtpReceiver_Params params; |
+ params.ssrc = ssrc; |
+ params.sender_ssrc = sender_ssrc; |
+ params.time_data = time_data; |
+ if (cast_message) { |
+ params.cast_message.reset( |
+ const_cast<media::cast::RtcpCastMessage*>(cast_message)); |
+ } |
+ params.target_delay = target_delay; |
+ if (rtcp_events) { |
+ params.rtcp_events.reset( |
+ const_cast<media::cast::ReceiverRtcpEventSubscriber::RtcpEvents*>( |
+ rtcp_events)); |
+ } |
+ if (rtp_receiver_statistics) { |
+ params.rtp_receiver_statistics.reset( |
+ const_cast<media::cast::RtpReceiverStatistics*>( |
+ rtp_receiver_statistics)); |
+ } |
+ // Note, params contains scoped_ptr<>, but this still works because |
+ // CastHostMsg_SendRtcpFromRtpReceiver doesn't take ownership, it |
+ // serializes it and remember the serialized form instead. |
+ Send(new CastHostMsg_SendRtcpFromRtpReceiver(channel_id_, params)); |
+ |
+ ignore_result(params.rtp_receiver_statistics.release()); |
+ ignore_result(params.cast_message.release()); |
+ ignore_result(params.rtcp_events.release()); |
+} |
+ |
+ |
void CastTransportSenderIPC::OnNotifyStatusChange( |
media::cast::CastTransportStatus status) { |
status_callback_.Run(status); |
@@ -114,6 +168,18 @@ void CastTransportSenderIPC::OnRtcpCastMessage( |
it->second.cast_message_cb.Run(cast_message); |
} |
+void CastTransportSenderIPC::OnReceivedPacket( |
+ const media::cast::Packet& packet) { |
+ if (!packet_callback_.is_null()) { |
+ // TODO(hubbe): Perhaps an non-ownership-transferring cb here? |
+ scoped_ptr<media::cast::Packet> packet_copy( |
+ new media::cast::Packet(packet)); |
+ packet_callback_.Run(packet_copy.Pass()); |
+ } else { |
+ DVLOG(1) << "CastIPCDispatcher::OnReceivedPacket no packet callback yet."; |
+ } |
+} |
+ |
void CastTransportSenderIPC::Send(IPC::Message* message) { |
if (CastIPCDispatcher::Get()) { |
CastIPCDispatcher::Get()->Send(message); |