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
3 // found in the LICENSE file.
5 #ifndef CHROME_RENDERER_MEDIA_CAST_TRANSPORT_SENDER_IPC_H_
6 #define CHROME_RENDERER_MEDIA_CAST_TRANSPORT_SENDER_IPC_H_
8 #include "base/message_loop/message_loop_proxy.h"
9 #include "ipc/ipc_channel_proxy.h"
10 #include "media/cast/transport/cast_transport_sender.h"
12 // This implementation of the CastTransportSender interface
13 // communicates with the browser process over IPC and relays
14 // all calls to/from the transport sender to the browser process.
15 // The primary reason for this arrangement is to give the
16 // renderer less direct control over the UDP sockets.
17 class CastTransportSenderIPC
18 : public media::cast::transport::CastTransportSender
{
20 CastTransportSenderIPC(
21 const media::cast::transport::CastTransportConfig
& config
,
22 const media::cast::transport::CastTransportStatusCallback
& status_cb
);
24 virtual ~CastTransportSenderIPC();
26 // media::cast::transport::CastTransportSender implementation.
27 virtual void SetPacketReceiver(
28 const media::cast::transport::PacketReceiverCallback
& packet_callback
)
30 virtual void InsertCodedAudioFrame(
31 const media::cast::transport::EncodedAudioFrame
* audio_frame
,
32 const base::TimeTicks
& recorded_time
) OVERRIDE
;
33 virtual void InsertCodedVideoFrame(
34 const media::cast::transport::EncodedVideoFrame
* video_frame
,
35 const base::TimeTicks
& capture_time
) OVERRIDE
;
36 virtual void SendRtcpFromRtpSender(
37 uint32 packet_type_flags
,
38 const media::cast::transport::RtcpSenderInfo
& sender_info
,
39 const media::cast::transport::RtcpDlrrReportBlock
& dlrr
,
40 const media::cast::transport::RtcpSenderLogMessage
& sender_log
,
42 const std::string
& c_name
) OVERRIDE
;
43 virtual void ResendPackets(
45 const media::cast::transport::MissingFramesAndPacketsMap
& missing_packets
)
47 virtual void SubscribeAudioRtpStatsCallback(
48 const media::cast::transport::CastTransportRtpStatistics
& callback
)
50 virtual void SubscribeVideoRtpStatsCallback(
51 const media::cast::transport::CastTransportRtpStatistics
& callback
)
54 void OnReceivedPacket(const media::cast::transport::Packet
& packet
);
55 void OnNotifyStatusChange(
56 media::cast::transport::CastTransportStatus status
);
59 const media::cast::transport::RtcpSenderInfo
& sender_info
,
60 base::TimeTicks time_sent
,
61 uint32 rtp_timestamp
);
64 void Send(IPC::Message
* message
);
67 media::cast::transport::PacketReceiverCallback packet_callback_
;
68 media::cast::transport::CastTransportStatusCallback status_callback_
;
69 media::cast::transport::CastTransportRtpStatistics audio_rtp_callback_
;
70 media::cast::transport::CastTransportRtpStatistics video_rtp_callback_
;
71 DISALLOW_COPY_AND_ASSIGN(CastTransportSenderIPC
);
74 #endif // CHROME_RENDERER_MEDIA_CAST_TRANSPORT_SENDER_IPC_H_