| 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 | 16 |
| 16 namespace media { | 17 namespace media { |
| 17 namespace cast { | 18 namespace cast { |
| 18 namespace transport { | 19 namespace transport { |
| 19 | 20 |
| 20 enum RtcpMode { | 21 enum RtcpMode { |
| 21 kRtcpCompound, // Compound RTCP mode is described by RFC 4585. | 22 kRtcpCompound, // Compound RTCP mode is described by RFC 4585. |
| 22 kRtcpReducedSize, // Reduced-size RTCP mode is described by RFC 5506. | 23 kRtcpReducedSize, // Reduced-size RTCP mode is described by RFC 5506. |
| 23 }; | 24 }; |
| 24 | 25 |
| 25 enum VideoCodec { | 26 enum VideoCodec { |
| 26 kVp8, | 27 kVp8, |
| 27 kH264, | 28 kH264, |
| 28 }; | 29 }; |
| 29 | 30 |
| 30 enum AudioCodec { | 31 enum AudioCodec { |
| 31 kOpus, | 32 kOpus, |
| 32 kPcm16, | 33 kPcm16, |
| 33 kExternalAudio, | 34 kExternalAudio, |
| 34 }; | 35 }; |
| 35 | 36 |
| 36 struct CastTransportConfig { | 37 struct MEDIA_EXPORT CastTransportConfig { |
| 37 CastTransportConfig(); | 38 CastTransportConfig(); |
| 38 ~CastTransportConfig(); | 39 ~CastTransportConfig(); |
| 39 | 40 |
| 40 // Transport: Local receiver. | 41 // Transport: Local receiver. |
| 42 // TODO(hubbe): Change to net::IPEndPoint |
| 41 std::string receiver_ip_address; | 43 std::string receiver_ip_address; |
| 42 std::string local_ip_address; | 44 std::string local_ip_address; |
| 43 int receive_port; | 45 int receive_port; |
| 44 int send_port; | 46 int send_port; |
| 45 | 47 |
| 46 uint32 audio_ssrc; | 48 uint32 audio_ssrc; |
| 47 uint32 video_ssrc; | 49 uint32 video_ssrc; |
| 48 | 50 |
| 49 VideoCodec video_codec; | 51 VideoCodec video_codec; |
| 50 AudioCodec audio_codec; | 52 AudioCodec audio_codec; |
| 51 | 53 |
| 52 // RTP. | 54 // RTP. |
| 53 int audio_rtp_history_ms; | 55 int audio_rtp_history_ms; |
| 54 int video_rtp_history_ms; | 56 int video_rtp_history_ms; |
| 55 int audio_rtp_max_delay_ms; | 57 int audio_rtp_max_delay_ms; |
| 56 int video_rtp_max_delay_ms; | 58 int video_rtp_max_delay_ms; |
| 57 int audio_rtp_payload_type; | 59 int audio_rtp_payload_type; |
| 58 int video_rtp_payload_type; | 60 int video_rtp_payload_type; |
| 59 | 61 |
| 60 int audio_frequency; | 62 int audio_frequency; |
| 61 int audio_channels; | 63 int audio_channels; |
| 62 | 64 |
| 63 std::string aes_key; // Binary string of size kAesKeySize. | 65 std::string aes_key; // Binary string of size kAesKeySize. |
| 64 std::string aes_iv_mask; // Binary string of size kAesBlockSize. | 66 std::string aes_iv_mask; // Binary string of size kAesBlockSize. |
| 65 }; | 67 }; |
| 66 | 68 |
| 67 struct EncodedVideoFrame { | 69 struct MEDIA_EXPORT EncodedVideoFrame { |
| 68 EncodedVideoFrame(); | 70 EncodedVideoFrame(); |
| 69 ~EncodedVideoFrame(); | 71 ~EncodedVideoFrame(); |
| 70 | 72 |
| 71 VideoCodec codec; | 73 VideoCodec codec; |
| 72 bool key_frame; | 74 bool key_frame; |
| 73 uint32 frame_id; | 75 uint32 frame_id; |
| 74 uint32 last_referenced_frame_id; | 76 uint32 last_referenced_frame_id; |
| 75 std::string data; | 77 std::string data; |
| 76 }; | 78 }; |
| 77 | 79 |
| 78 struct EncodedAudioFrame { | 80 struct MEDIA_EXPORT EncodedAudioFrame { |
| 79 EncodedAudioFrame(); | 81 EncodedAudioFrame(); |
| 80 ~EncodedAudioFrame(); | 82 ~EncodedAudioFrame(); |
| 81 | 83 |
| 82 AudioCodec codec; | 84 AudioCodec codec; |
| 83 uint32 frame_id; // Needed to release the frame. | 85 uint32 frame_id; // Needed to release the frame. |
| 84 int samples; // Needed send side to advance the RTP timestamp. | 86 int samples; // Needed send side to advance the RTP timestamp. |
| 85 // Not used receive side. | 87 // Not used receive side. |
| 86 // Support for max sampling rate of 48KHz, 2 channels, 100 ms duration. | 88 // Support for max sampling rate of 48KHz, 2 channels, 100 ms duration. |
| 87 static const int kMaxNumberOfSamples = 48 * 2 * 100; | 89 static const int kMaxNumberOfSamples = 48 * 2 * 100; |
| 88 std::string data; | 90 std::string data; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 122 |
| 121 // Log messages form sender to receiver. | 123 // Log messages form sender to receiver. |
| 122 // TODO(mikhal): Refactor to Chromium style (MACRO_STYLE). | 124 // TODO(mikhal): Refactor to Chromium style (MACRO_STYLE). |
| 123 enum RtcpSenderFrameStatus { | 125 enum RtcpSenderFrameStatus { |
| 124 kRtcpSenderFrameStatusUnknown = 0, | 126 kRtcpSenderFrameStatusUnknown = 0, |
| 125 kRtcpSenderFrameStatusDroppedByEncoder = 1, | 127 kRtcpSenderFrameStatusDroppedByEncoder = 1, |
| 126 kRtcpSenderFrameStatusDroppedByFlowControl = 2, | 128 kRtcpSenderFrameStatusDroppedByFlowControl = 2, |
| 127 kRtcpSenderFrameStatusSentToNetwork = 3, | 129 kRtcpSenderFrameStatusSentToNetwork = 3, |
| 128 }; | 130 }; |
| 129 | 131 |
| 130 struct RtcpSenderFrameLogMessage { | 132 struct MEDIA_EXPORT RtcpSenderFrameLogMessage { |
| 131 RtcpSenderFrameLogMessage(); | 133 RtcpSenderFrameLogMessage(); |
| 132 ~RtcpSenderFrameLogMessage(); | 134 ~RtcpSenderFrameLogMessage(); |
| 133 RtcpSenderFrameStatus frame_status; | 135 RtcpSenderFrameStatus frame_status; |
| 134 uint32 rtp_timestamp; | 136 uint32 rtp_timestamp; |
| 135 }; | 137 }; |
| 136 | 138 |
| 137 typedef std::list<RtcpSenderFrameLogMessage> RtcpSenderLogMessage; | 139 typedef std::vector<RtcpSenderFrameLogMessage> RtcpSenderLogMessage; |
| 138 | 140 |
| 139 struct RtcpSenderInfo { | 141 struct MEDIA_EXPORT RtcpSenderInfo { |
| 140 RtcpSenderInfo(); | 142 RtcpSenderInfo(); |
| 141 ~RtcpSenderInfo(); | 143 ~RtcpSenderInfo(); |
| 142 // First three members are used for lipsync. | 144 // First three members are used for lipsync. |
| 143 // First two members are used for rtt. | 145 // First two members are used for rtt. |
| 144 uint32 ntp_seconds; | 146 uint32 ntp_seconds; |
| 145 uint32 ntp_fraction; | 147 uint32 ntp_fraction; |
| 146 uint32 rtp_timestamp; | 148 uint32 rtp_timestamp; |
| 147 uint32 send_packet_count; | 149 uint32 send_packet_count; |
| 148 size_t send_octet_count; | 150 size_t send_octet_count; |
| 149 }; | 151 }; |
| 150 | 152 |
| 151 struct RtcpReportBlock { | 153 struct RtcpReportBlock { |
| 152 RtcpReportBlock(); | 154 RtcpReportBlock(); |
| 153 ~RtcpReportBlock(); | 155 ~RtcpReportBlock(); |
| 154 uint32 remote_ssrc; // SSRC of sender of this report. | 156 uint32 remote_ssrc; // SSRC of sender of this report. |
| 155 uint32 media_ssrc; // SSRC of the RTP packet sender. | 157 uint32 media_ssrc; // SSRC of the RTP packet sender. |
| 156 uint8 fraction_lost; | 158 uint8 fraction_lost; |
| 157 uint32 cumulative_lost; // 24 bits valid. | 159 uint32 cumulative_lost; // 24 bits valid. |
| 158 uint32 extended_high_sequence_number; | 160 uint32 extended_high_sequence_number; |
| 159 uint32 jitter; | 161 uint32 jitter; |
| 160 uint32 last_sr; | 162 uint32 last_sr; |
| 161 uint32 delay_since_last_sr; | 163 uint32 delay_since_last_sr; |
| 162 }; | 164 }; |
| 163 | 165 |
| 164 struct RtcpDlrrReportBlock { | 166 struct MEDIA_EXPORT RtcpDlrrReportBlock { |
| 165 RtcpDlrrReportBlock(); | 167 RtcpDlrrReportBlock(); |
| 166 ~RtcpDlrrReportBlock(); | 168 ~RtcpDlrrReportBlock(); |
| 167 uint32 last_rr; | 169 uint32 last_rr; |
| 168 uint32 delay_since_last_rr; | 170 uint32 delay_since_last_rr; |
| 169 }; | 171 }; |
| 170 | 172 |
| 171 inline bool operator==(RtcpSenderInfo lhs, RtcpSenderInfo rhs) { | 173 inline bool operator==(RtcpSenderInfo lhs, RtcpSenderInfo rhs) { |
| 172 return lhs.ntp_seconds == rhs.ntp_seconds && | 174 return lhs.ntp_seconds == rhs.ntp_seconds && |
| 173 lhs.ntp_fraction == rhs.ntp_fraction && | 175 lhs.ntp_fraction == rhs.ntp_fraction && |
| 174 lhs.rtp_timestamp == rhs.rtp_timestamp && | 176 lhs.rtp_timestamp == rhs.rtp_timestamp && |
| 175 lhs.send_packet_count == rhs.send_packet_count && | 177 lhs.send_packet_count == rhs.send_packet_count && |
| 176 lhs.send_octet_count == rhs.send_octet_count; | 178 lhs.send_octet_count == rhs.send_octet_count; |
| 177 } | 179 } |
| 178 | 180 |
| 179 } // namespace transport | 181 } // namespace transport |
| 180 } // namespace cast | 182 } // namespace cast |
| 181 } // namespace media | 183 } // namespace media |
| 182 | 184 |
| 183 #endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_CONFIG_H_ | 185 #endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_CONFIG_H_ |
| OLD | NEW |