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

Side by Side Diff: chrome/renderer/media/cast_transport_sender_ipc.cc

Issue 178073004: Cast: IPC from browser to renderer to send packet events from transport to cast library. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 months 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 unified diff | Download patch
OLDNEW
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 net::IPEndPoint& local_end_point, 16 const net::IPEndPoint& local_end_point,
17 const net::IPEndPoint& remote_end_point, 17 const net::IPEndPoint& remote_end_point,
18 const media::cast::transport::CastTransportStatusCallback& status_cb) 18 const media::cast::transport::CastTransportStatusCallback& status_cb,
19 : status_callback_(status_cb) { 19 const media::cast::CastLoggingConfig& logging_config,
20 const media::cast::transport::BulkRawEventsCallback& raw_events_cb)
21 : status_callback_(status_cb), raw_events_callback_(raw_events_cb) {
20 if (CastIPCDispatcher::Get()) { 22 if (CastIPCDispatcher::Get()) {
21 channel_id_ = CastIPCDispatcher::Get()->AddSender(this); 23 channel_id_ = CastIPCDispatcher::Get()->AddSender(this);
22 } 24 }
23 Send(new CastHostMsg_New(channel_id_, local_end_point, remote_end_point)); 25 Send(new CastHostMsg_New(
26 channel_id_, local_end_point, remote_end_point, logging_config));
24 } 27 }
25 28
26 CastTransportSenderIPC::~CastTransportSenderIPC() { 29 CastTransportSenderIPC::~CastTransportSenderIPC() {
27 Send(new CastHostMsg_Delete(channel_id_)); 30 Send(new CastHostMsg_Delete(channel_id_));
28 if (CastIPCDispatcher::Get()) { 31 if (CastIPCDispatcher::Get()) {
29 CastIPCDispatcher::Get()->RemoveSender(channel_id_); 32 CastIPCDispatcher::Get()->RemoveSender(channel_id_);
30 } 33 }
31 } 34 }
32 35
33 void CastTransportSenderIPC::SetPacketReceiver( 36 void CastTransportSenderIPC::SetPacketReceiver(
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 103
101 104
102 void CastTransportSenderIPC::OnReceivedPacket( 105 void CastTransportSenderIPC::OnReceivedPacket(
103 const media::cast::Packet& packet) { 106 const media::cast::Packet& packet) {
104 if (!packet_callback_.is_null()) { 107 if (!packet_callback_.is_null()) {
105 // TODO(hubbe): Perhaps an non-ownership-transferring cb here? 108 // TODO(hubbe): Perhaps an non-ownership-transferring cb here?
106 scoped_ptr<media::cast::transport::Packet> packet_copy( 109 scoped_ptr<media::cast::transport::Packet> packet_copy(
107 new media::cast::transport::Packet(packet)); 110 new media::cast::transport::Packet(packet));
108 packet_callback_.Run(packet_copy.Pass()); 111 packet_callback_.Run(packet_copy.Pass());
109 } else { 112 } else {
110 LOG(ERROR) << "CastIPCDispatcher::OnReceivedPacket " 113 DVLOG(1) << "CastIPCDispatcher::OnReceivedPacket no packet callback yet.";
111 << "no packet callback yet.";
112 } 114 }
113 } 115 }
114 116
115 void CastTransportSenderIPC::OnNotifyStatusChange( 117 void CastTransportSenderIPC::OnNotifyStatusChange(
116 media::cast::transport::CastTransportStatus status) { 118 media::cast::transport::CastTransportStatus status) {
117 status_callback_.Run(status); 119 status_callback_.Run(status);
118 } 120 }
119 121
120 void CastTransportSenderIPC::OnRtpStatistics( 122 void CastTransportSenderIPC::OnRtpStatistics(
121 bool audio, 123 bool audio,
122 const media::cast::transport::RtcpSenderInfo& sender_info, 124 const media::cast::transport::RtcpSenderInfo& sender_info,
123 base::TimeTicks time_sent, 125 base::TimeTicks time_sent,
124 uint32 rtp_timestamp) { 126 uint32 rtp_timestamp) {
125 const media::cast::transport::CastTransportRtpStatistics& callback = 127 const media::cast::transport::CastTransportRtpStatistics& callback =
126 audio ? audio_rtp_callback_ : video_rtp_callback_; 128 audio ? audio_rtp_callback_ : video_rtp_callback_;
127 callback.Run(sender_info, time_sent, rtp_timestamp); 129 callback.Run(sender_info, time_sent, rtp_timestamp);
128 } 130 }
129 131
132 void CastTransportSenderIPC::OnRawEvents(
133 const std::vector<media::cast::PacketEvent>& packet_events) {
134 raw_events_callback_.Run(packet_events);
135 }
136
130 void CastTransportSenderIPC::Send(IPC::Message* message) { 137 void CastTransportSenderIPC::Send(IPC::Message* message) {
131 if (CastIPCDispatcher::Get()) { 138 if (CastIPCDispatcher::Get()) {
132 CastIPCDispatcher::Get()->Send(message); 139 CastIPCDispatcher::Get()->Send(message);
133 } else { 140 } else {
134 delete message; 141 delete message;
135 } 142 }
136 } 143 }
OLDNEW
« no previous file with comments | « chrome/renderer/media/cast_transport_sender_ipc.h ('k') | media/cast/audio_sender/audio_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698