#include "base/callback.h"
#include "base/memory/ref_counted.h"
#include "media/cast/transport/cast_transport_defines.h"
+#include "net/base/ip_endpoint.h"
namespace media {
namespace cast {
namespace transport {
enum RtcpMode {
- kRtcpCompound, // Compound RTCP mode is described by RFC 4585.
+ kRtcpCompound, // Compound RTCP mode is described by RFC 4585.
kRtcpReducedSize, // Reduced-size RTCP mode is described by RFC 5506.
};
-enum VideoCodec {
- kVp8,
- kH264,
-};
+enum VideoCodec { kVp8, kH264, };
+
+enum AudioCodec { kOpus, kPcm16, kExternalAudio, };
-enum AudioCodec {
- kOpus,
- kPcm16,
- kExternalAudio,
+struct RtpConfig {
+ RtpConfig();
+ int history_ms; // The time RTP packets are stored for retransmissions.
+ int max_delay_ms;
+ int payload_type;
};
struct CastTransportConfig {
~CastTransportConfig();
// Transport: Local receiver.
- std::string receiver_ip_address;
- std::string local_ip_address;
- int receive_port;
- int send_port;
+ net::IPEndPoint receiver_endpoint;
+ net::IPEndPoint local_endpoint;
uint32 audio_ssrc;
uint32 video_ssrc;
AudioCodec audio_codec;
// RTP.
- int audio_rtp_history_ms;
- int video_rtp_history_ms;
- int audio_rtp_max_delay_ms;
- int video_rtp_max_delay_ms;
- int audio_rtp_payload_type;
- int video_rtp_payload_type;
+ RtpConfig audio_rtp_config;
+ RtpConfig video_rtp_config;
int audio_frequency;
int audio_channels;
- std::string aes_key; // Binary string of size kAesKeySize.
+ std::string aes_key; // Binary string of size kAesKeySize.
std::string aes_iv_mask; // Binary string of size kAesBlockSize.
};
bool key_frame;
uint32 frame_id;
uint32 last_referenced_frame_id;
+ uint32 rtp_timestamp;
std::string data;
};
AudioCodec codec;
uint32 frame_id; // Needed to release the frame.
- int samples; // Needed send side to advance the RTP timestamp.
- // Not used receive side.
+ uint32 rtp_timestamp;
// Support for max sampling rate of 48KHz, 2 channels, 100 ms duration.
static const int kMaxNumberOfSamples = 48 * 2 * 100;
std::string data;
typedef std::vector<uint8> Packet;
typedef std::vector<Packet> PacketList;
-class PacketReceiver : public base::RefCountedThreadSafe<PacketReceiver> {
- public:
- // All packets received from the network should be delivered via this
- // function.
- virtual void ReceivedPacket(const uint8* packet, size_t length,
- const base::Closure callback) = 0;
-
- static void DeletePacket(const uint8* packet);
-
- protected:
- virtual ~PacketReceiver() {}
-
- private:
- friend class base::RefCountedThreadSafe<PacketReceiver>;
-};
+typedef base::Callback<void(scoped_ptr<Packet> packet)> PacketReceiverCallback;
class PacketSender {
public:
uint32 rtp_timestamp;
};
-typedef std::list<RtcpSenderFrameLogMessage> RtcpSenderLogMessage;
+typedef std::vector<RtcpSenderFrameLogMessage> RtcpSenderLogMessage;
struct RtcpSenderInfo {
RtcpSenderInfo();
RtcpReportBlock();
~RtcpReportBlock();
uint32 remote_ssrc; // SSRC of sender of this report.
- uint32 media_ssrc; // SSRC of the RTP packet sender.
+ uint32 media_ssrc; // SSRC of the RTP packet sender.
uint8 fraction_lost;
uint32 cumulative_lost; // 24 bits valid.
uint32 extended_high_sequence_number;
uint32 delay_since_last_rr;
};
+// This is only needed because IPC messages don't support more than
+// 5 arguments.
+struct SendRtcpFromRtpSenderData {
+ SendRtcpFromRtpSenderData();
+ ~SendRtcpFromRtpSenderData();
+ uint32 packet_type_flags;
+ uint32 sending_ssrc;
+ std::string c_name;
+};
+
inline bool operator==(RtcpSenderInfo lhs, RtcpSenderInfo rhs) {
return lhs.ntp_seconds == rhs.ntp_seconds &&
- lhs.ntp_fraction == rhs.ntp_fraction &&
- lhs.rtp_timestamp == rhs.rtp_timestamp &&
- lhs.send_packet_count == rhs.send_packet_count &&
- lhs.send_octet_count == rhs.send_octet_count;
+ lhs.ntp_fraction == rhs.ntp_fraction &&
+ lhs.rtp_timestamp == rhs.rtp_timestamp &&
+ lhs.send_packet_count == rhs.send_packet_count &&
+ lhs.send_octet_count == rhs.send_octet_count;
}
} // namespace transport
} // namespace cast
} // namespace media
-#endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_CONFIG_H_
+#endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_CONFIG_H_