#ifndef MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_CONFIG_H_
#define MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_CONFIG_H_
#include <string>
#include <vector>
#include "base/basictypes.h"
#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,
kRtcpReducedSize,
};
enum VideoCodec {
kVp8,
kH264,
kVideoCodecLast = kH264
};
enum AudioCodec {
kOpus,
kPcm16,
kExternalAudio,
kAudioCodecLast = kExternalAudio
};
struct RtpConfig {
RtpConfig();
int history_ms;
int max_delay_ms;
int payload_type;
};
struct CastTransportBaseConfig {
CastTransportBaseConfig();
~CastTransportBaseConfig();
uint32 ssrc;
RtpConfig rtp_config;
std::string aes_key;
std::string aes_iv_mask;
};
struct CastTransportAudioConfig {
CastTransportAudioConfig();
~CastTransportAudioConfig();
CastTransportBaseConfig base;
AudioCodec codec;
int frequency;
int channels;
};
struct CastTransportVideoConfig {
CastTransportVideoConfig();
~CastTransportVideoConfig();
CastTransportBaseConfig base;
VideoCodec codec;
};
struct EncodedVideoFrame {
EncodedVideoFrame();
~EncodedVideoFrame();
VideoCodec codec;
bool key_frame;
uint32 frame_id;
uint32 last_referenced_frame_id;
uint32 rtp_timestamp;
std::string data;
};
struct EncodedAudioFrame {
EncodedAudioFrame();
~EncodedAudioFrame();
AudioCodec codec;
uint32 frame_id;
uint32 rtp_timestamp;
static const int kMaxNumberOfSamples = 48 * 2 * 100;
std::string data;
};
typedef std::vector<uint8> Packet;
typedef std::vector<Packet> PacketList;
typedef base::Callback<void(scoped_ptr<Packet> packet)> PacketReceiverCallback;
class PacketSender {
public:
virtual bool SendPacket(const transport::Packet& packet) = 0;
virtual ~PacketSender() {}
};
enum RtcpSenderFrameStatus {
kRtcpSenderFrameStatusUnknown = 0,
kRtcpSenderFrameStatusDroppedByEncoder = 1,
kRtcpSenderFrameStatusDroppedByFlowControl = 2,
kRtcpSenderFrameStatusSentToNetwork = 3,
kRtcpSenderFrameStatusLast = kRtcpSenderFrameStatusSentToNetwork
};
struct RtcpSenderFrameLogMessage {
RtcpSenderFrameLogMessage();
~RtcpSenderFrameLogMessage();
RtcpSenderFrameStatus frame_status;
uint32 rtp_timestamp;
};
typedef std::vector<RtcpSenderFrameLogMessage> RtcpSenderLogMessage;
struct RtcpSenderInfo {
RtcpSenderInfo();
~RtcpSenderInfo();
uint32 ntp_seconds;
uint32 ntp_fraction;
uint32 rtp_timestamp;
uint32 send_packet_count;
size_t send_octet_count;
};
struct RtcpReportBlock {
RtcpReportBlock();
~RtcpReportBlock();
uint32 remote_ssrc;
uint32 media_ssrc;
uint8 fraction_lost;
uint32 cumulative_lost;
uint32 extended_high_sequence_number;
uint32 jitter;
uint32 last_sr;
uint32 delay_since_last_sr;
};
struct RtcpDlrrReportBlock {
RtcpDlrrReportBlock();
~RtcpDlrrReportBlock();
uint32 last_rr;
uint32 delay_since_last_rr;
};
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;
}
}
}
}
#endif