X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fmedia%2Fcast%2Ftransport%2Fcast_transport_config.h;h=d8474f40d66656bf84fc5d2211d4625de3d96f74;hb=ff3e2503a20db9193d323c1d19c38c68004dec4a;hp=15015cdba06f94da5aa4b8a9763647785e1d9dbf;hpb=7338fba38ba696536d1cc9d389afd716a6ab2fe6;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/media/cast/transport/cast_transport_config.h b/src/media/cast/transport/cast_transport_config.h index 15015cd..d8474f4 100644 --- a/src/media/cast/transport/cast_transport_config.h +++ b/src/media/cast/transport/cast_transport_config.h @@ -12,25 +12,26 @@ #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 { @@ -38,10 +39,8 @@ 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; @@ -50,17 +49,13 @@ struct CastTransportConfig { 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. }; @@ -72,6 +67,7 @@ struct EncodedVideoFrame { bool key_frame; uint32 frame_id; uint32 last_referenced_frame_id; + uint32 rtp_timestamp; std::string data; }; @@ -81,8 +77,7 @@ struct EncodedAudioFrame { 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; @@ -91,21 +86,7 @@ struct EncodedAudioFrame { typedef std::vector Packet; typedef std::vector PacketList; -class PacketReceiver : public base::RefCountedThreadSafe { - 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; -}; +typedef base::Callback packet)> PacketReceiverCallback; class PacketSender { public: @@ -132,7 +113,7 @@ struct RtcpSenderFrameLogMessage { uint32 rtp_timestamp; }; -typedef std::list RtcpSenderLogMessage; +typedef std::vector RtcpSenderLogMessage; struct RtcpSenderInfo { RtcpSenderInfo(); @@ -150,7 +131,7 @@ struct RtcpReportBlock { 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; @@ -166,16 +147,26 @@ struct RtcpDlrrReportBlock { 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_