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> |
| 9 |
8 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
9 #include "ipc/ipc_channel_proxy.h" | 11 #include "ipc/ipc_channel_proxy.h" |
10 #include "media/cast/logging/logging_defines.h" | 12 #include "media/cast/logging/logging_defines.h" |
11 #include "media/cast/net/cast_transport_sender.h" | 13 #include "media/cast/net/cast_transport_sender.h" |
12 | 14 |
13 // This implementation of the CastTransportSender interface | 15 // This implementation of the CastTransportSender interface |
14 // communicates with the browser process over IPC and relays | 16 // communicates with the browser process over IPC and relays |
15 // all calls to/from the transport sender to the browser process. | 17 // all calls to/from the transport sender to the browser process. |
16 // The primary reason for this arrangement is to give the | 18 // The primary reason for this arrangement is to give the |
17 // renderer less direct control over the UDP sockets. | 19 // renderer less direct control over the UDP sockets. |
18 class CastTransportSenderIPC | 20 class CastTransportSenderIPC |
19 : public media::cast::CastTransportSender { | 21 : public media::cast::CastTransportSender { |
20 public: | 22 public: |
21 CastTransportSenderIPC( | 23 CastTransportSenderIPC( |
22 const net::IPEndPoint& remote_end_point, | 24 const net::IPEndPoint& remote_end_point, |
23 const media::cast::CastTransportStatusCallback& status_cb, | 25 const media::cast::CastTransportStatusCallback& status_cb, |
24 const media::cast::BulkRawEventsCallback& raw_events_cb); | 26 const media::cast::BulkRawEventsCallback& raw_events_cb); |
25 | 27 |
26 virtual ~CastTransportSenderIPC(); | 28 virtual ~CastTransportSenderIPC(); |
27 | 29 |
28 // media::cast::CastTransportSender implementation. | 30 // media::cast::CastTransportSender implementation. |
29 virtual void SetPacketReceiver( | |
30 const media::cast::PacketReceiverCallback& packet_callback) | |
31 OVERRIDE; | |
32 virtual void InitializeAudio( | 31 virtual void InitializeAudio( |
33 const media::cast::CastTransportRtpConfig& config) OVERRIDE; | 32 const media::cast::CastTransportRtpConfig& config, |
| 33 const media::cast::RtcpCastMessageCallback& cast_message_cb, |
| 34 const media::cast::RtcpRttCallback& rtt_cb) OVERRIDE; |
34 virtual void InitializeVideo( | 35 virtual void InitializeVideo( |
35 const media::cast::CastTransportRtpConfig& config) OVERRIDE; | 36 const media::cast::CastTransportRtpConfig& config, |
| 37 const media::cast::RtcpCastMessageCallback& cast_message_cb, |
| 38 const media::cast::RtcpRttCallback& rtt_cb) OVERRIDE; |
36 virtual void InsertCodedAudioFrame( | 39 virtual void InsertCodedAudioFrame( |
37 const media::cast::EncodedFrame& audio_frame) OVERRIDE; | 40 const media::cast::EncodedFrame& audio_frame) OVERRIDE; |
38 virtual void InsertCodedVideoFrame( | 41 virtual void InsertCodedVideoFrame( |
39 const media::cast::EncodedFrame& video_frame) OVERRIDE; | 42 const media::cast::EncodedFrame& video_frame) OVERRIDE; |
40 virtual void SendRtcpFromRtpSender( | 43 virtual void SendSenderReport( |
41 uint32 packet_type_flags, | 44 uint32 ssrc, |
42 uint32 ntp_seconds, | 45 base::TimeTicks current_time, |
43 uint32 ntp_fraction, | 46 uint32 current_time_as_rtp_timestamp) OVERRIDE; |
44 uint32 rtp_timestamp, | |
45 const media::cast::RtcpDlrrReportBlock& dlrr, | |
46 uint32 sending_ssrc, | |
47 const std::string& c_name) OVERRIDE; | |
48 virtual void ResendPackets( | 47 virtual void ResendPackets( |
49 bool is_audio, | 48 bool is_audio, |
50 const media::cast::MissingFramesAndPacketsMap& missing_packets, | 49 const media::cast::MissingFramesAndPacketsMap& missing_packets, |
51 bool cancel_rtx_if_not_in_list, | 50 bool cancel_rtx_if_not_in_list, |
52 base::TimeDelta dedupe_window) | 51 base::TimeDelta dedupe_window) |
53 OVERRIDE; | 52 OVERRIDE; |
54 | 53 |
55 void OnReceivedPacket(const media::cast::Packet& packet); | |
56 void OnNotifyStatusChange( | 54 void OnNotifyStatusChange( |
57 media::cast::CastTransportStatus status); | 55 media::cast::CastTransportStatus status); |
58 void OnRawEvents(const std::vector<media::cast::PacketEvent>& packet_events); | 56 void OnRawEvents(const std::vector<media::cast::PacketEvent>& packet_events, |
| 57 const std::vector<media::cast::FrameEvent>& frame_events); |
| 58 void OnRtt(uint32 ssrc, const media::cast::RtcpRttReport& rtt_report); |
| 59 void OnRtcpCastMessage(uint32 ssrc, |
| 60 const media::cast::RtcpCastMessage& cast_message); |
59 | 61 |
60 private: | 62 private: |
| 63 struct ClientCallbacks { |
| 64 ClientCallbacks(); |
| 65 ~ClientCallbacks(); |
| 66 |
| 67 media::cast::RtcpCastMessageCallback cast_message_cb; |
| 68 media::cast::RtcpRttCallback rtt_cb; |
| 69 }; |
| 70 |
61 void Send(IPC::Message* message); | 71 void Send(IPC::Message* message); |
62 | 72 |
63 int32 channel_id_; | 73 int32 channel_id_; |
64 media::cast::PacketReceiverCallback packet_callback_; | 74 media::cast::PacketReceiverCallback packet_callback_; |
65 media::cast::CastTransportStatusCallback status_callback_; | 75 media::cast::CastTransportStatusCallback status_callback_; |
66 media::cast::BulkRawEventsCallback raw_events_callback_; | 76 media::cast::BulkRawEventsCallback raw_events_callback_; |
| 77 typedef std::map<uint32, ClientCallbacks> ClientMap; |
| 78 ClientMap clients_; |
67 | 79 |
68 DISALLOW_COPY_AND_ASSIGN(CastTransportSenderIPC); | 80 DISALLOW_COPY_AND_ASSIGN(CastTransportSenderIPC); |
69 }; | 81 }; |
70 | 82 |
71 #endif // CHROME_RENDERER_MEDIA_CAST_TRANSPORT_SENDER_IPC_H_ | 83 #endif // CHROME_RENDERER_MEDIA_CAST_TRANSPORT_SENDER_IPC_H_ |
OLD | NEW |