| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 int32_t SetAbsoluteSendTime(uint32_t absolute_send_time); | 159 int32_t SetAbsoluteSendTime(uint32_t absolute_send_time); |
| 160 void SetVideoRotation(VideoRotation rotation); | 160 void SetVideoRotation(VideoRotation rotation); |
| 161 int32_t SetTransportSequenceNumber(uint16_t sequence_number); | 161 int32_t SetTransportSequenceNumber(uint16_t sequence_number); |
| 162 | 162 |
| 163 int32_t RegisterRtpHeaderExtension(RTPExtensionType type, uint8_t id); | 163 int32_t RegisterRtpHeaderExtension(RTPExtensionType type, uint8_t id); |
| 164 bool IsRtpHeaderExtensionRegistered(RTPExtensionType type) override; | 164 bool IsRtpHeaderExtensionRegistered(RTPExtensionType type) override; |
| 165 int32_t DeregisterRtpHeaderExtension(RTPExtensionType type); | 165 int32_t DeregisterRtpHeaderExtension(RTPExtensionType type); |
| 166 | 166 |
| 167 size_t RtpHeaderExtensionLength() const; | 167 size_t RtpHeaderExtensionLength() const; |
| 168 | 168 |
| 169 uint16_t BuildRTPHeaderExtension(uint8_t* data_buffer, bool marker_bit) const; | 169 uint16_t BuildRTPHeaderExtension(uint8_t* data_buffer, bool marker_bit) const |
| 170 EXCLUSIVE_LOCKS_REQUIRED(send_critsect_); |
| 170 | 171 |
| 171 uint8_t BuildTransmissionTimeOffsetExtension(uint8_t *data_buffer) const; | 172 uint8_t BuildTransmissionTimeOffsetExtension(uint8_t* data_buffer) const |
| 172 uint8_t BuildAudioLevelExtension(uint8_t* data_buffer) const; | 173 EXCLUSIVE_LOCKS_REQUIRED(send_critsect_); |
| 173 uint8_t BuildAbsoluteSendTimeExtension(uint8_t* data_buffer) const; | 174 uint8_t BuildAudioLevelExtension(uint8_t* data_buffer) const |
| 174 uint8_t BuildVideoRotationExtension(uint8_t* data_buffer) const; | 175 EXCLUSIVE_LOCKS_REQUIRED(send_critsect_); |
| 176 uint8_t BuildAbsoluteSendTimeExtension(uint8_t* data_buffer) const |
| 177 EXCLUSIVE_LOCKS_REQUIRED(send_critsect_); |
| 178 uint8_t BuildVideoRotationExtension(uint8_t* data_buffer) const |
| 179 EXCLUSIVE_LOCKS_REQUIRED(send_critsect_); |
| 175 uint8_t BuildTransportSequenceNumberExtension(uint8_t* data_buffer, | 180 uint8_t BuildTransportSequenceNumberExtension(uint8_t* data_buffer, |
| 176 uint16_t sequence_number) const; | 181 uint16_t sequence_number) const |
| 182 EXCLUSIVE_LOCKS_REQUIRED(send_critsect_); |
| 177 uint8_t BuildPlayoutDelayExtension(uint8_t* data_buffer, | 183 uint8_t BuildPlayoutDelayExtension(uint8_t* data_buffer, |
| 178 uint16_t min_playout_delay_ms, | 184 uint16_t min_playout_delay_ms, |
| 179 uint16_t max_playout_delay_ms) const; | 185 uint16_t max_playout_delay_ms) const |
| 186 EXCLUSIVE_LOCKS_REQUIRED(send_critsect_); |
| 180 | 187 |
| 181 // Verifies that the specified extension is registered, and that it is | 188 // Verifies that the specified extension is registered, and that it is |
| 182 // present in rtp packet. If extension is not registered kNotRegistered is | 189 // present in rtp packet. If extension is not registered kNotRegistered is |
| 183 // returned. If extension cannot be found in the rtp header, or if it is | 190 // returned. If extension cannot be found in the rtp header, or if it is |
| 184 // malformed, kError is returned. Otherwise *extension_offset is set to the | 191 // malformed, kError is returned. Otherwise *extension_offset is set to the |
| 185 // offset of the extension from the beginning of the rtp packet and kOk is | 192 // offset of the extension from the beginning of the rtp packet and kOk is |
| 186 // returned. | 193 // returned. |
| 187 enum class ExtensionStatus { | 194 enum class ExtensionStatus { |
| 188 kNotRegistered, | 195 kNotRegistered, |
| 189 kOk, | 196 kOk, |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 // Send-side delay is the difference between transmission time and capture | 335 // Send-side delay is the difference between transmission time and capture |
| 329 // time. | 336 // time. |
| 330 typedef std::map<int64_t, int> SendDelayMap; | 337 typedef std::map<int64_t, int> SendDelayMap; |
| 331 | 338 |
| 332 size_t CreateRtpHeader(uint8_t* header, | 339 size_t CreateRtpHeader(uint8_t* header, |
| 333 int8_t payload_type, | 340 int8_t payload_type, |
| 334 uint32_t ssrc, | 341 uint32_t ssrc, |
| 335 bool marker_bit, | 342 bool marker_bit, |
| 336 uint32_t timestamp, | 343 uint32_t timestamp, |
| 337 uint16_t sequence_number, | 344 uint16_t sequence_number, |
| 338 const std::vector<uint32_t>& csrcs) const; | 345 const std::vector<uint32_t>& csrcs) const |
| 346 EXCLUSIVE_LOCKS_REQUIRED(send_critsect_); |
| 339 | 347 |
| 340 bool PrepareAndSendPacket(uint8_t* buffer, | 348 bool PrepareAndSendPacket(uint8_t* buffer, |
| 341 size_t length, | 349 size_t length, |
| 342 int64_t capture_time_ms, | 350 int64_t capture_time_ms, |
| 343 bool send_over_rtx, | 351 bool send_over_rtx, |
| 344 bool is_retransmit, | 352 bool is_retransmit, |
| 345 int probe_cluster_id); | 353 int probe_cluster_id); |
| 346 | 354 |
| 347 // Return the number of bytes sent. Note that both of these functions may | 355 // Return the number of bytes sent. Note that both of these functions may |
| 348 // return a larger value that their argument. | 356 // return a larger value that their argument. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 363 void UpdateOnSendPacket(int packet_id, | 371 void UpdateOnSendPacket(int packet_id, |
| 364 int64_t capture_time_ms, | 372 int64_t capture_time_ms, |
| 365 uint32_t ssrc); | 373 uint32_t ssrc); |
| 366 | 374 |
| 367 // Find the byte position of the RTP extension as indicated by |type| in | 375 // Find the byte position of the RTP extension as indicated by |type| in |
| 368 // |rtp_packet|. Return false if such extension doesn't exist. | 376 // |rtp_packet|. Return false if such extension doesn't exist. |
| 369 bool FindHeaderExtensionPosition(RTPExtensionType type, | 377 bool FindHeaderExtensionPosition(RTPExtensionType type, |
| 370 const uint8_t* rtp_packet, | 378 const uint8_t* rtp_packet, |
| 371 size_t rtp_packet_length, | 379 size_t rtp_packet_length, |
| 372 const RTPHeader& rtp_header, | 380 const RTPHeader& rtp_header, |
| 373 size_t* position) const; | 381 size_t* position) const |
| 382 EXCLUSIVE_LOCKS_REQUIRED(send_critsect_); |
| 374 | 383 |
| 375 void UpdateTransmissionTimeOffset(uint8_t* rtp_packet, | 384 void UpdateTransmissionTimeOffset(uint8_t* rtp_packet, |
| 376 size_t rtp_packet_length, | 385 size_t rtp_packet_length, |
| 377 const RTPHeader& rtp_header, | 386 const RTPHeader& rtp_header, |
| 378 int64_t time_diff_ms) const; | 387 int64_t time_diff_ms) const; |
| 379 void UpdateAbsoluteSendTime(uint8_t* rtp_packet, | 388 void UpdateAbsoluteSendTime(uint8_t* rtp_packet, |
| 380 size_t rtp_packet_length, | 389 size_t rtp_packet_length, |
| 381 const RTPHeader& rtp_header, | 390 const RTPHeader& rtp_header, |
| 382 int64_t now_ms) const; | 391 int64_t now_ms) const; |
| 383 | 392 |
| 384 bool UpdateTransportSequenceNumber(uint16_t sequence_number, | 393 bool UpdateTransportSequenceNumber(uint8_t* rtp_packet, |
| 385 uint8_t* rtp_packet, | |
| 386 size_t rtp_packet_length, | 394 size_t rtp_packet_length, |
| 387 const RTPHeader& rtp_header) const; | 395 const RTPHeader& rtp_header, |
| 396 int* sequence_number) const; |
| 388 | 397 |
| 389 void UpdatePlayoutDelayLimits(uint8_t* rtp_packet, | 398 void UpdatePlayoutDelayLimits(uint8_t* rtp_packet, |
| 390 size_t rtp_packet_length, | 399 size_t rtp_packet_length, |
| 391 const RTPHeader& rtp_header, | 400 const RTPHeader& rtp_header, |
| 392 uint16_t min_playout_delay, | 401 uint16_t min_playout_delay, |
| 393 uint16_t max_playout_delay) const; | 402 uint16_t max_playout_delay) const; |
| 394 | 403 |
| 395 bool AllocateTransportSequenceNumber(int* packet_id) const; | 404 bool AllocateTransportSequenceNumber(int* packet_id) const; |
| 396 | 405 |
| 397 void UpdateRtpStats(const uint8_t* buffer, | 406 void UpdateRtpStats(const uint8_t* buffer, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 416 rtc::CriticalSection send_critsect_; | 425 rtc::CriticalSection send_critsect_; |
| 417 | 426 |
| 418 Transport *transport_; | 427 Transport *transport_; |
| 419 bool sending_media_ GUARDED_BY(send_critsect_); | 428 bool sending_media_ GUARDED_BY(send_critsect_); |
| 420 | 429 |
| 421 size_t max_payload_length_; | 430 size_t max_payload_length_; |
| 422 | 431 |
| 423 int8_t payload_type_ GUARDED_BY(send_critsect_); | 432 int8_t payload_type_ GUARDED_BY(send_critsect_); |
| 424 std::map<int8_t, RtpUtility::Payload*> payload_type_map_; | 433 std::map<int8_t, RtpUtility::Payload*> payload_type_map_; |
| 425 | 434 |
| 426 RtpHeaderExtensionMap rtp_header_extension_map_; | 435 RtpHeaderExtensionMap rtp_header_extension_map_ GUARDED_BY(send_critsect_); |
| 427 int32_t transmission_time_offset_; | 436 int32_t transmission_time_offset_; |
| 428 uint32_t absolute_send_time_; | 437 uint32_t absolute_send_time_; |
| 429 VideoRotation rotation_; | 438 VideoRotation rotation_; |
| 430 bool video_rotation_active_; | 439 bool video_rotation_active_; |
| 431 uint16_t transport_sequence_number_; | 440 uint16_t transport_sequence_number_; |
| 432 | 441 |
| 433 // Tracks the current request for playout delay limits from application | 442 // Tracks the current request for playout delay limits from application |
| 434 // and decides whether the current RTP frame should include the playout | 443 // and decides whether the current RTP frame should include the playout |
| 435 // delay extension on header. | 444 // delay extension on header. |
| 436 PlayoutDelayOracle playout_delay_oracle_; | 445 PlayoutDelayOracle playout_delay_oracle_; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 std::map<int8_t, int8_t> rtx_payload_type_map_ GUARDED_BY(send_critsect_); | 484 std::map<int8_t, int8_t> rtx_payload_type_map_ GUARDED_BY(send_critsect_); |
| 476 | 485 |
| 477 RateLimiter* const retransmission_rate_limiter_; | 486 RateLimiter* const retransmission_rate_limiter_; |
| 478 | 487 |
| 479 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSender); | 488 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSender); |
| 480 }; | 489 }; |
| 481 | 490 |
| 482 } // namespace webrtc | 491 } // namespace webrtc |
| 483 | 492 |
| 484 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ | 493 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_H_ |
| OLD | NEW |