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 net::IPEndPoint& local_end_point, |
| 17 const net::IPEndPoint& remote_end_point, |
17 const media::cast::transport::CastTransportStatusCallback& status_cb) | 18 const media::cast::transport::CastTransportStatusCallback& status_cb) |
18 : status_callback_(status_cb) { | 19 : status_callback_(status_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_, local_end_point, remote_end_point)); |
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_); |
29 } | 30 } |
30 } | 31 } |
31 | 32 |
32 void CastTransportSenderIPC::SetPacketReceiver( | 33 void CastTransportSenderIPC::SetPacketReceiver( |
33 const media::cast::transport::PacketReceiverCallback& packet_callback) { | 34 const media::cast::transport::PacketReceiverCallback& packet_callback) { |
34 packet_callback_ = packet_callback; | 35 packet_callback_ = packet_callback; |
35 } | 36 } |
36 | 37 |
| 38 void CastTransportSenderIPC::InitializeAudio( |
| 39 const media::cast::transport::CastTransportAudioConfig& config) { |
| 40 Send(new CastHostMsg_InitializeAudio(channel_id_, config)); |
| 41 } |
| 42 |
| 43 void CastTransportSenderIPC::InitializeVideo( |
| 44 const media::cast::transport::CastTransportVideoConfig& config) { |
| 45 Send(new CastHostMsg_InitializeVideo(channel_id_, config)); |
| 46 } |
| 47 |
37 void CastTransportSenderIPC::InsertCodedAudioFrame( | 48 void CastTransportSenderIPC::InsertCodedAudioFrame( |
38 const media::cast::transport::EncodedAudioFrame* audio_frame, | 49 const media::cast::transport::EncodedAudioFrame* audio_frame, |
39 const base::TimeTicks& recorded_time) { | 50 const base::TimeTicks& recorded_time) { |
40 Send(new CastHostMsg_InsertCodedAudioFrame(channel_id_, | 51 Send(new CastHostMsg_InsertCodedAudioFrame(channel_id_, |
41 *audio_frame, | 52 *audio_frame, |
42 recorded_time)); | 53 recorded_time)); |
43 } | 54 } |
44 | 55 |
45 void CastTransportSenderIPC::InsertCodedVideoFrame( | 56 void CastTransportSenderIPC::InsertCodedVideoFrame( |
46 const media::cast::transport::EncodedVideoFrame* video_frame, | 57 const media::cast::transport::EncodedVideoFrame* video_frame, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 callback.Run(sender_info, time_sent, rtp_timestamp); | 127 callback.Run(sender_info, time_sent, rtp_timestamp); |
117 } | 128 } |
118 | 129 |
119 void CastTransportSenderIPC::Send(IPC::Message* message) { | 130 void CastTransportSenderIPC::Send(IPC::Message* message) { |
120 if (CastIPCDispatcher::Get()) { | 131 if (CastIPCDispatcher::Get()) { |
121 CastIPCDispatcher::Get()->Send(message); | 132 CastIPCDispatcher::Get()->Send(message); |
122 } else { | 133 } else { |
123 delete message; | 134 delete message; |
124 } | 135 } |
125 } | 136 } |
OLD | NEW |