| 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 MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_CONFIG_H_ | 5 #ifndef MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_CONFIG_H_ |
| 6 #define MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_CONFIG_H_ | 6 #define MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_CONFIG_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "media/base/media_export.h" |
| 14 #include "media/cast/transport/cast_transport_defines.h" | 15 #include "media/cast/transport/cast_transport_defines.h" |
| 15 #include "net/base/ip_endpoint.h" | 16 #include "net/base/ip_endpoint.h" |
| 16 | 17 |
| 17 namespace media { | 18 namespace media { |
| 18 namespace cast { | 19 namespace cast { |
| 19 namespace transport { | 20 namespace transport { |
| 20 | 21 |
| 21 enum RtcpMode { | 22 enum RtcpMode { |
| 22 kRtcpCompound, // Compound RTCP mode is described by RFC 4585. | 23 kRtcpCompound, // Compound RTCP mode is described by RFC 4585. |
| 23 kRtcpReducedSize, // Reduced-size RTCP mode is described by RFC 5506. | 24 kRtcpReducedSize, // Reduced-size RTCP mode is described by RFC 5506. |
| 24 }; | 25 }; |
| 25 | 26 |
| 26 enum VideoCodec { | 27 enum VideoCodec { |
| 27 kVp8, | 28 kVp8, |
| 28 kH264, | 29 kH264, |
| 29 }; | 30 }; |
| 30 | 31 |
| 31 enum AudioCodec { | 32 enum AudioCodec { |
| 32 kOpus, | 33 kOpus, |
| 33 kPcm16, | 34 kPcm16, |
| 34 kExternalAudio, | 35 kExternalAudio, |
| 35 }; | 36 }; |
| 36 | 37 |
| 37 struct RtpConfig { | 38 struct MEDIA_EXPORT RtpConfig { |
| 38 RtpConfig(); | 39 RtpConfig(); |
| 39 int history_ms; // The time RTP packets are stored for retransmissions. | 40 int history_ms; // The time RTP packets are stored for retransmissions. |
| 40 int max_delay_ms; | 41 int max_delay_ms; |
| 41 int payload_type; | 42 int payload_type; |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 struct CastTransportConfig { | 45 struct MEDIA_EXPORT CastTransportConfig { |
| 45 CastTransportConfig(); | 46 CastTransportConfig(); |
| 46 ~CastTransportConfig(); | 47 ~CastTransportConfig(); |
| 47 | 48 |
| 48 // Transport: Local receiver. | 49 // Transport: Local receiver. |
| 49 net::IPEndPoint receiver_endpoint; | 50 net::IPEndPoint receiver_endpoint; |
| 50 net::IPEndPoint local_endpoint; | 51 net::IPEndPoint local_endpoint; |
| 51 | 52 |
| 52 uint32 audio_ssrc; | 53 uint32 audio_ssrc; |
| 53 uint32 video_ssrc; | 54 uint32 video_ssrc; |
| 54 | 55 |
| 55 VideoCodec video_codec; | 56 VideoCodec video_codec; |
| 56 AudioCodec audio_codec; | 57 AudioCodec audio_codec; |
| 57 | 58 |
| 58 // RTP. | 59 // RTP. |
| 59 RtpConfig audio_rtp_config; | 60 RtpConfig audio_rtp_config; |
| 60 RtpConfig video_rtp_config; | 61 RtpConfig video_rtp_config; |
| 61 | 62 |
| 62 int audio_frequency; | 63 int audio_frequency; |
| 63 int audio_channels; | 64 int audio_channels; |
| 64 | 65 |
| 65 std::string aes_key; // Binary string of size kAesKeySize. | 66 std::string aes_key; // Binary string of size kAesKeySize. |
| 66 std::string aes_iv_mask; // Binary string of size kAesBlockSize. | 67 std::string aes_iv_mask; // Binary string of size kAesBlockSize. |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 struct EncodedVideoFrame { | 70 struct MEDIA_EXPORT EncodedVideoFrame { |
| 70 EncodedVideoFrame(); | 71 EncodedVideoFrame(); |
| 71 ~EncodedVideoFrame(); | 72 ~EncodedVideoFrame(); |
| 72 | 73 |
| 73 VideoCodec codec; | 74 VideoCodec codec; |
| 74 bool key_frame; | 75 bool key_frame; |
| 75 uint32 frame_id; | 76 uint32 frame_id; |
| 76 uint32 last_referenced_frame_id; | 77 uint32 last_referenced_frame_id; |
| 77 std::string data; | 78 std::string data; |
| 78 }; | 79 }; |
| 79 | 80 |
| 80 struct EncodedAudioFrame { | 81 struct MEDIA_EXPORT EncodedAudioFrame { |
| 81 EncodedAudioFrame(); | 82 EncodedAudioFrame(); |
| 82 ~EncodedAudioFrame(); | 83 ~EncodedAudioFrame(); |
| 83 | 84 |
| 84 AudioCodec codec; | 85 AudioCodec codec; |
| 85 uint32 frame_id; // Needed to release the frame. | 86 uint32 frame_id; // Needed to release the frame. |
| 86 int samples; // Needed send side to advance the RTP timestamp. | 87 int samples; // Needed send side to advance the RTP timestamp. |
| 87 // Not used receive side. | 88 // Not used receive side. |
| 88 // Support for max sampling rate of 48KHz, 2 channels, 100 ms duration. | 89 // Support for max sampling rate of 48KHz, 2 channels, 100 ms duration. |
| 89 static const int kMaxNumberOfSamples = 48 * 2 * 100; | 90 static const int kMaxNumberOfSamples = 48 * 2 * 100; |
| 90 std::string data; | 91 std::string data; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 107 | 108 |
| 108 // Log messages form sender to receiver. | 109 // Log messages form sender to receiver. |
| 109 // TODO(mikhal): Refactor to Chromium style (MACRO_STYLE). | 110 // TODO(mikhal): Refactor to Chromium style (MACRO_STYLE). |
| 110 enum RtcpSenderFrameStatus { | 111 enum RtcpSenderFrameStatus { |
| 111 kRtcpSenderFrameStatusUnknown = 0, | 112 kRtcpSenderFrameStatusUnknown = 0, |
| 112 kRtcpSenderFrameStatusDroppedByEncoder = 1, | 113 kRtcpSenderFrameStatusDroppedByEncoder = 1, |
| 113 kRtcpSenderFrameStatusDroppedByFlowControl = 2, | 114 kRtcpSenderFrameStatusDroppedByFlowControl = 2, |
| 114 kRtcpSenderFrameStatusSentToNetwork = 3, | 115 kRtcpSenderFrameStatusSentToNetwork = 3, |
| 115 }; | 116 }; |
| 116 | 117 |
| 117 struct RtcpSenderFrameLogMessage { | 118 struct MEDIA_EXPORT RtcpSenderFrameLogMessage { |
| 118 RtcpSenderFrameLogMessage(); | 119 RtcpSenderFrameLogMessage(); |
| 119 ~RtcpSenderFrameLogMessage(); | 120 ~RtcpSenderFrameLogMessage(); |
| 120 RtcpSenderFrameStatus frame_status; | 121 RtcpSenderFrameStatus frame_status; |
| 121 uint32 rtp_timestamp; | 122 uint32 rtp_timestamp; |
| 122 }; | 123 }; |
| 123 | 124 |
| 124 typedef std::list<RtcpSenderFrameLogMessage> RtcpSenderLogMessage; | 125 typedef std::vector<RtcpSenderFrameLogMessage> RtcpSenderLogMessage; |
| 125 | 126 |
| 126 struct RtcpSenderInfo { | 127 struct MEDIA_EXPORT RtcpSenderInfo { |
| 127 RtcpSenderInfo(); | 128 RtcpSenderInfo(); |
| 128 ~RtcpSenderInfo(); | 129 ~RtcpSenderInfo(); |
| 129 // First three members are used for lipsync. | 130 // First three members are used for lipsync. |
| 130 // First two members are used for rtt. | 131 // First two members are used for rtt. |
| 131 uint32 ntp_seconds; | 132 uint32 ntp_seconds; |
| 132 uint32 ntp_fraction; | 133 uint32 ntp_fraction; |
| 133 uint32 rtp_timestamp; | 134 uint32 rtp_timestamp; |
| 134 uint32 send_packet_count; | 135 uint32 send_packet_count; |
| 135 size_t send_octet_count; | 136 size_t send_octet_count; |
| 136 }; | 137 }; |
| 137 | 138 |
| 138 struct RtcpReportBlock { | 139 struct RtcpReportBlock { |
| 139 RtcpReportBlock(); | 140 RtcpReportBlock(); |
| 140 ~RtcpReportBlock(); | 141 ~RtcpReportBlock(); |
| 141 uint32 remote_ssrc; // SSRC of sender of this report. | 142 uint32 remote_ssrc; // SSRC of sender of this report. |
| 142 uint32 media_ssrc; // SSRC of the RTP packet sender. | 143 uint32 media_ssrc; // SSRC of the RTP packet sender. |
| 143 uint8 fraction_lost; | 144 uint8 fraction_lost; |
| 144 uint32 cumulative_lost; // 24 bits valid. | 145 uint32 cumulative_lost; // 24 bits valid. |
| 145 uint32 extended_high_sequence_number; | 146 uint32 extended_high_sequence_number; |
| 146 uint32 jitter; | 147 uint32 jitter; |
| 147 uint32 last_sr; | 148 uint32 last_sr; |
| 148 uint32 delay_since_last_sr; | 149 uint32 delay_since_last_sr; |
| 149 }; | 150 }; |
| 150 | 151 |
| 151 struct RtcpDlrrReportBlock { | 152 struct MEDIA_EXPORT RtcpDlrrReportBlock { |
| 152 RtcpDlrrReportBlock(); | 153 RtcpDlrrReportBlock(); |
| 153 ~RtcpDlrrReportBlock(); | 154 ~RtcpDlrrReportBlock(); |
| 154 uint32 last_rr; | 155 uint32 last_rr; |
| 155 uint32 delay_since_last_rr; | 156 uint32 delay_since_last_rr; |
| 156 }; | 157 }; |
| 157 | 158 |
| 159 // This is only needed because IPC messages don't support more than |
| 160 // 5 arguments. |
| 161 struct MEDIA_EXPORT SendRtcpFromRtpSenderData { |
| 162 SendRtcpFromRtpSenderData(); |
| 163 ~SendRtcpFromRtpSenderData(); |
| 164 uint32 packet_type_flags; |
| 165 uint32 sending_ssrc; |
| 166 std::string c_name; |
| 167 }; |
| 168 |
| 158 inline bool operator==(RtcpSenderInfo lhs, RtcpSenderInfo rhs) { | 169 inline bool operator==(RtcpSenderInfo lhs, RtcpSenderInfo rhs) { |
| 159 return lhs.ntp_seconds == rhs.ntp_seconds && | 170 return lhs.ntp_seconds == rhs.ntp_seconds && |
| 160 lhs.ntp_fraction == rhs.ntp_fraction && | 171 lhs.ntp_fraction == rhs.ntp_fraction && |
| 161 lhs.rtp_timestamp == rhs.rtp_timestamp && | 172 lhs.rtp_timestamp == rhs.rtp_timestamp && |
| 162 lhs.send_packet_count == rhs.send_packet_count && | 173 lhs.send_packet_count == rhs.send_packet_count && |
| 163 lhs.send_octet_count == rhs.send_octet_count; | 174 lhs.send_octet_count == rhs.send_octet_count; |
| 164 } | 175 } |
| 165 | 176 |
| 166 } // namespace transport | 177 } // namespace transport |
| 167 } // namespace cast | 178 } // namespace cast |
| 168 } // namespace media | 179 } // namespace media |
| 169 | 180 |
| 170 #endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_CONFIG_H_ | 181 #endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_CONFIG_H_ |
| OLD | NEW |