Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10077)

Unified Diff: chrome/renderer/media/cast_transport_sender_ipc.cc

Issue 765643006: Cast: Make receiver use cast_transport (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..95dcc2369457414bba5a86264470db15fe44921e 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,54 @@ void CastTransportSenderIPC::ResendFrameForKickstart(
frame_id));
}
+void CastTransportSenderIPC::AddValidSsrc(uint32 ssrc) {
+ Send(new CastHostMsg_AddValidSsrc(channel_id_, ssrc));
+}
+
+
+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
+ // 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<
miu 2014/12/04 04:18:53 Line 118 and 119 can be one LOC.
hubbe 2014/12/05 23:57:20 Done.
+ 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));
+
+ (void)params.rtp_receiver_statistics.release();
+ (void)params.cast_message.release();
+ (void)params.rtcp_events.release();
+}
+
+
void CastTransportSenderIPC::OnNotifyStatusChange(
media::cast::CastTransportStatus status) {
status_callback_.Run(status);
@@ -114,6 +169,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);

Powered by Google App Engine
This is Rietveld 408576698