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 #ifndef CHROME_RENDERER_MEDIA_CAST_TRANSPORT_SENDER_IPC_H_ | 5 #ifndef CHROME_RENDERER_MEDIA_CAST_TRANSPORT_SENDER_IPC_H_ |
6 #define CHROME_RENDERER_MEDIA_CAST_TRANSPORT_SENDER_IPC_H_ | 6 #define CHROME_RENDERER_MEDIA_CAST_TRANSPORT_SENDER_IPC_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
11 #include "ipc/ipc_channel_proxy.h" | 11 #include "ipc/ipc_channel_proxy.h" |
12 #include "media/cast/logging/logging_defines.h" | 12 #include "media/cast/logging/logging_defines.h" |
13 #include "media/cast/net/cast_transport_sender.h" | 13 #include "media/cast/net/cast_transport_sender.h" |
14 | 14 |
15 // This implementation of the CastTransportSender interface | 15 // This implementation of the CastTransportSender interface |
16 // communicates with the browser process over IPC and relays | 16 // communicates with the browser process over IPC and relays |
17 // all calls to/from the transport sender to the browser process. | 17 // all calls to/from the transport sender to the browser process. |
18 // The primary reason for this arrangement is to give the | 18 // The primary reason for this arrangement is to give the |
19 // renderer less direct control over the UDP sockets. | 19 // renderer less direct control over the UDP sockets. |
20 class CastTransportSenderIPC | 20 class CastTransportSenderIPC |
21 : public media::cast::CastTransportSender { | 21 : public media::cast::CastTransportSender { |
22 public: | 22 public: |
23 CastTransportSenderIPC( | 23 CastTransportSenderIPC( |
| 24 const net::IPEndPoint& local_end_point, |
24 const net::IPEndPoint& remote_end_point, | 25 const net::IPEndPoint& remote_end_point, |
25 scoped_ptr<base::DictionaryValue> options, | 26 scoped_ptr<base::DictionaryValue> options, |
| 27 const media::cast::PacketReceiverCallback& packet_callback, |
26 const media::cast::CastTransportStatusCallback& status_cb, | 28 const media::cast::CastTransportStatusCallback& status_cb, |
27 const media::cast::BulkRawEventsCallback& raw_events_cb); | 29 const media::cast::BulkRawEventsCallback& raw_events_cb); |
28 | 30 |
29 ~CastTransportSenderIPC() override; | 31 ~CastTransportSenderIPC() override; |
30 | 32 |
31 // media::cast::CastTransportSender implementation. | 33 // media::cast::CastTransportSender implementation. |
32 void InitializeAudio( | 34 void InitializeAudio( |
33 const media::cast::CastTransportRtpConfig& config, | 35 const media::cast::CastTransportRtpConfig& config, |
34 const media::cast::RtcpCastMessageCallback& cast_message_cb, | 36 const media::cast::RtcpCastMessageCallback& cast_message_cb, |
35 const media::cast::RtcpRttCallback& rtt_cb) override; | 37 const media::cast::RtcpRttCallback& rtt_cb) override; |
36 void InitializeVideo( | 38 void InitializeVideo( |
37 const media::cast::CastTransportRtpConfig& config, | 39 const media::cast::CastTransportRtpConfig& config, |
38 const media::cast::RtcpCastMessageCallback& cast_message_cb, | 40 const media::cast::RtcpCastMessageCallback& cast_message_cb, |
39 const media::cast::RtcpRttCallback& rtt_cb) override; | 41 const media::cast::RtcpRttCallback& rtt_cb) override; |
40 void InsertFrame(uint32 ssrc, | 42 void InsertFrame(uint32 ssrc, |
41 const media::cast::EncodedFrame& frame) override; | 43 const media::cast::EncodedFrame& frame) override; |
42 void SendSenderReport(uint32 ssrc, | 44 void SendSenderReport(uint32 ssrc, |
43 base::TimeTicks current_time, | 45 base::TimeTicks current_time, |
44 uint32 current_time_as_rtp_timestamp) override; | 46 uint32 current_time_as_rtp_timestamp) override; |
45 void CancelSendingFrames(uint32 ssrc, | 47 void CancelSendingFrames(uint32 ssrc, |
46 const std::vector<uint32>& frame_ids) override; | 48 const std::vector<uint32>& frame_ids) override; |
47 void ResendFrameForKickstart(uint32 ssrc, uint32 frame_id) override; | 49 void ResendFrameForKickstart(uint32 ssrc, uint32 frame_id) override; |
| 50 void AddValidSsrc(uint32 ssrc) override; |
| 51 void SendRtcpFromRtpReceiver( |
| 52 uint32 ssrc, |
| 53 uint32 sender_ssrc, |
| 54 const media::cast::RtcpTimeData& time_data, |
| 55 const media::cast::RtcpCastMessage* cast_message, |
| 56 base::TimeDelta target_delay, |
| 57 const media::cast::ReceiverRtcpEventSubscriber::RtcpEvents* |
| 58 rtcp_events, |
| 59 const media::cast::RtpReceiverStatistics* rtp_receiver_statistics) |
| 60 override; |
48 | 61 |
49 void OnNotifyStatusChange( | 62 void OnNotifyStatusChange( |
50 media::cast::CastTransportStatus status); | 63 media::cast::CastTransportStatus status); |
51 void OnRawEvents(const std::vector<media::cast::PacketEvent>& packet_events, | 64 void OnRawEvents(const std::vector<media::cast::PacketEvent>& packet_events, |
52 const std::vector<media::cast::FrameEvent>& frame_events); | 65 const std::vector<media::cast::FrameEvent>& frame_events); |
53 void OnRtt(uint32 ssrc, base::TimeDelta rtt); | 66 void OnRtt(uint32 ssrc, base::TimeDelta rtt); |
54 void OnRtcpCastMessage(uint32 ssrc, | 67 void OnRtcpCastMessage(uint32 ssrc, |
55 const media::cast::RtcpCastMessage& cast_message); | 68 const media::cast::RtcpCastMessage& cast_message); |
| 69 void OnReceivedPacket(const media::cast::Packet& packet); |
56 | 70 |
57 private: | 71 private: |
58 struct ClientCallbacks { | 72 struct ClientCallbacks { |
59 ClientCallbacks(); | 73 ClientCallbacks(); |
60 ~ClientCallbacks(); | 74 ~ClientCallbacks(); |
61 | 75 |
62 media::cast::RtcpCastMessageCallback cast_message_cb; | 76 media::cast::RtcpCastMessageCallback cast_message_cb; |
63 media::cast::RtcpRttCallback rtt_cb; | 77 media::cast::RtcpRttCallback rtt_cb; |
64 }; | 78 }; |
65 | 79 |
66 void Send(IPC::Message* message); | 80 void Send(IPC::Message* message); |
67 | 81 |
68 int32 channel_id_; | 82 int32 channel_id_; |
69 media::cast::PacketReceiverCallback packet_callback_; | 83 media::cast::PacketReceiverCallback packet_callback_; |
70 media::cast::CastTransportStatusCallback status_callback_; | 84 media::cast::CastTransportStatusCallback status_callback_; |
71 media::cast::BulkRawEventsCallback raw_events_callback_; | 85 media::cast::BulkRawEventsCallback raw_events_callback_; |
72 typedef std::map<uint32, ClientCallbacks> ClientMap; | 86 typedef std::map<uint32, ClientCallbacks> ClientMap; |
73 ClientMap clients_; | 87 ClientMap clients_; |
74 | 88 |
75 DISALLOW_COPY_AND_ASSIGN(CastTransportSenderIPC); | 89 DISALLOW_COPY_AND_ASSIGN(CastTransportSenderIPC); |
76 }; | 90 }; |
77 | 91 |
78 #endif // CHROME_RENDERER_MEDIA_CAST_TRANSPORT_SENDER_IPC_H_ | 92 #endif // CHROME_RENDERER_MEDIA_CAST_TRANSPORT_SENDER_IPC_H_ |
OLD | NEW |