| 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 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 namespace rtcp { | 34 namespace rtcp { |
| 35 class TransportFeedback; | 35 class TransportFeedback; |
| 36 } | 36 } |
| 37 | 37 |
| 38 class RtpRtcp : public Module { | 38 class RtpRtcp : public Module { |
| 39 public: | 39 public: |
| 40 struct Configuration { | 40 struct Configuration { |
| 41 Configuration(); | 41 Configuration(); |
| 42 | 42 |
| 43 /* id - Unique identifier of this RTP/RTCP module object | 43 // True for a audio version of the RTP/RTCP module object false will create |
| 44 * audio - True for a audio version of the RTP/RTCP module | 44 // a video version. |
| 45 * object false will create a video version | 45 bool audio = false; |
| 46 * clock - The clock to use to read time. If NULL object | 46 bool receiver_only = false; |
| 47 * will be using the system clock. | 47 |
| 48 * incoming_data - Callback object that will receive the incoming | 48 // The clock to use to read time. If nullptr then system clock will be used. |
| 49 * data. May not be NULL; default callback will do | 49 Clock* clock = nullptr; |
| 50 * nothing. | 50 |
| 51 * incoming_messages - Callback object that will receive the incoming | |
| 52 * RTP messages. May not be NULL; default callback | |
| 53 * will do nothing. | |
| 54 * outgoing_transport - Transport object that will be called when packets | |
| 55 * are ready to be sent out on the network | |
| 56 * intra_frame_callback - Called when the receiver request a intra frame. | |
| 57 * bandwidth_callback - Called when we receive a changed estimate from | |
| 58 * the receiver of out stream. | |
| 59 * remote_bitrate_estimator - Estimates the bandwidth available for a set of | |
| 60 * streams from the same client. | |
| 61 * paced_sender - Spread any bursts of packets into smaller | |
| 62 * bursts to minimize packet loss. | |
| 63 */ | |
| 64 bool audio; | |
| 65 bool receiver_only; | |
| 66 Clock* clock; | |
| 67 ReceiveStatistics* receive_statistics; | 51 ReceiveStatistics* receive_statistics; |
| 68 Transport* outgoing_transport; | 52 |
| 69 RtcpIntraFrameObserver* intra_frame_callback; | 53 // Transport object that will be called when packets are ready to be sent |
| 70 RtcpBandwidthObserver* bandwidth_callback; | 54 // out on the network. |
| 71 TransportFeedbackObserver* transport_feedback_callback; | 55 Transport* outgoing_transport = nullptr; |
| 72 RtcpRttStats* rtt_stats; | 56 |
| 73 RtcpPacketTypeCounterObserver* rtcp_packet_type_counter_observer; | 57 // Called when the receiver request a intra frame. |
| 74 RemoteBitrateEstimator* remote_bitrate_estimator; | 58 RtcpIntraFrameObserver* intra_frame_callback = nullptr; |
| 75 RtpPacketSender* paced_sender; | 59 |
| 76 TransportSequenceNumberAllocator* transport_sequence_number_allocator; | 60 // Called when we receive a changed estimate from the receiver of out |
| 77 BitrateStatisticsObserver* send_bitrate_observer; | 61 // stream. |
| 78 FrameCountObserver* send_frame_count_observer; | 62 RtcpBandwidthObserver* bandwidth_callback = nullptr; |
| 79 SendSideDelayObserver* send_side_delay_observer; | 63 |
| 80 RtcEventLog* event_log; | 64 TransportFeedbackObserver* transport_feedback_callback = nullptr; |
| 81 SendPacketObserver* send_packet_observer; | 65 RtcpRttStats* rtt_stats = nullptr; |
| 66 RtcpPacketTypeCounterObserver* rtcp_packet_type_counter_observer = nullptr; |
| 67 |
| 68 // Estimates the bandwidth available for a set of streams from the same |
| 69 // client. |
| 70 RemoteBitrateEstimator* remote_bitrate_estimator = nullptr; |
| 71 |
| 72 // Spread any bursts of packets into smaller bursts to minimize packet loss. |
| 73 RtpPacketSender* paced_sender = nullptr; |
| 74 |
| 75 TransportSequenceNumberAllocator* transport_sequence_number_allocator = |
| 76 nullptr; |
| 77 BitrateStatisticsObserver* send_bitrate_observer = nullptr; |
| 78 FrameCountObserver* send_frame_count_observer = nullptr; |
| 79 SendSideDelayObserver* send_side_delay_observer = nullptr; |
| 80 RtcEventLog* event_log = nullptr; |
| 81 SendPacketObserver* send_packet_observer = nullptr; |
| 82 |
| 83 private: |
| 82 RTC_DISALLOW_COPY_AND_ASSIGN(Configuration); | 84 RTC_DISALLOW_COPY_AND_ASSIGN(Configuration); |
| 83 }; | 85 }; |
| 84 | 86 |
| 85 /* | 87 /* |
| 86 * Create a RTP/RTCP module object using the system clock. | 88 * Create a RTP/RTCP module object using the system clock. |
| 87 * | 89 * |
| 88 * configuration - Configuration of the RTP/RTCP module. | 90 * configuration - Configuration of the RTP/RTCP module. |
| 89 */ | 91 */ |
| 90 static RtpRtcp* CreateRtpRtcp(const RtpRtcp::Configuration& configuration); | 92 static RtpRtcp* CreateRtpRtcp(const RtpRtcp::Configuration& configuration); |
| 91 | 93 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 */ | 168 */ |
| 167 virtual int32_t RegisterSendPayload( | 169 virtual int32_t RegisterSendPayload( |
| 168 const VideoCodec& videoCodec) = 0; | 170 const VideoCodec& videoCodec) = 0; |
| 169 | 171 |
| 170 virtual void RegisterVideoSendPayload(int payload_type, | 172 virtual void RegisterVideoSendPayload(int payload_type, |
| 171 const char* payload_name) = 0; | 173 const char* payload_name) = 0; |
| 172 | 174 |
| 173 /* | 175 /* |
| 174 * Unregister a send payload | 176 * Unregister a send payload |
| 175 * | 177 * |
| 176 * payloadType - payload type of codec | 178 * payload_type - payload type of codec |
| 177 * | 179 * |
| 178 * return -1 on failure else 0 | 180 * return -1 on failure else 0 |
| 179 */ | 181 */ |
| 180 virtual int32_t DeRegisterSendPayload(int8_t payloadType) = 0; | 182 virtual int32_t DeRegisterSendPayload(int8_t payload_type) = 0; |
| 181 | 183 |
| 182 /* | 184 /* |
| 183 * (De)register RTP header extension type and id. | 185 * (De)register RTP header extension type and id. |
| 184 * | 186 * |
| 185 * return -1 on failure else 0 | 187 * return -1 on failure else 0 |
| 186 */ | 188 */ |
| 187 virtual int32_t RegisterSendRtpHeaderExtension(RTPExtensionType type, | 189 virtual int32_t RegisterSendRtpHeaderExtension(RTPExtensionType type, |
| 188 uint8_t id) = 0; | 190 uint8_t id) = 0; |
| 189 | 191 |
| 190 virtual int32_t DeregisterSendRtpHeaderExtension(RTPExtensionType type) = 0; | 192 virtual int32_t DeregisterSendRtpHeaderExtension(RTPExtensionType type) = 0; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 */ | 287 */ |
| 286 virtual void BitrateSent(uint32_t* totalRate, | 288 virtual void BitrateSent(uint32_t* totalRate, |
| 287 uint32_t* videoRate, | 289 uint32_t* videoRate, |
| 288 uint32_t* fecRate, | 290 uint32_t* fecRate, |
| 289 uint32_t* nackRate) const = 0; | 291 uint32_t* nackRate) const = 0; |
| 290 | 292 |
| 291 /* | 293 /* |
| 292 * Used by the codec module to deliver a video or audio frame for | 294 * Used by the codec module to deliver a video or audio frame for |
| 293 * packetization. | 295 * packetization. |
| 294 * | 296 * |
| 295 * frameType - type of frame to send | 297 * frame_type - type of frame to send |
| 296 * payloadType - payload type of frame to send | 298 * payload_type - payload type of frame to send |
| 297 * timestamp - timestamp of frame to send | 299 * timestamp - timestamp of frame to send |
| 298 * payloadData - payload buffer of frame to send | 300 * payload_data - payload buffer of frame to send |
| 299 * payloadSize - size of payload buffer to send | 301 * payload_size - size of payload buffer to send |
| 300 * fragmentation - fragmentation offset data for fragmented frames such | 302 * fragmentation - fragmentation offset data for fragmented frames such |
| 301 * as layers or RED | 303 * as layers or RED |
| 302 * | 304 * |
| 303 * return -1 on failure else 0 | 305 * return -1 on failure else 0 |
| 304 */ | 306 */ |
| 305 virtual int32_t SendOutgoingData( | 307 virtual int32_t SendOutgoingData( |
| 306 FrameType frameType, | 308 FrameType frame_type, |
| 307 int8_t payloadType, | 309 int8_t payload_type, |
| 308 uint32_t timeStamp, | 310 uint32_t timeStamp, |
| 309 int64_t capture_time_ms, | 311 int64_t capture_time_ms, |
| 310 const uint8_t* payloadData, | 312 const uint8_t* payload_data, |
| 311 size_t payloadSize, | 313 size_t payload_size, |
| 312 const RTPFragmentationHeader* fragmentation = NULL, | 314 const RTPFragmentationHeader* fragmentation = NULL, |
| 313 const RTPVideoHeader* rtpVideoHdr = NULL) = 0; | 315 const RTPVideoHeader* rtpVideoHdr = NULL) = 0; |
| 314 | 316 |
| 315 virtual bool TimeToSendPacket(uint32_t ssrc, | 317 virtual bool TimeToSendPacket(uint32_t ssrc, |
| 316 uint16_t sequence_number, | 318 uint16_t sequence_number, |
| 317 int64_t capture_time_ms, | 319 int64_t capture_time_ms, |
| 318 bool retransmission, | 320 bool retransmission, |
| 319 int probe_cluster_id) = 0; | 321 int probe_cluster_id) = 0; |
| 320 | 322 |
| 321 virtual size_t TimeToSendPadding(size_t bytes, int probe_cluster_id) = 0; | 323 virtual size_t TimeToSendPadding(size_t bytes, int probe_cluster_id) = 0; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 349 * | 351 * |
| 350 * return -1 on failure else 0 | 352 * return -1 on failure else 0 |
| 351 */ | 353 */ |
| 352 virtual int32_t SetCNAME(const char* c_name) = 0; | 354 virtual int32_t SetCNAME(const char* c_name) = 0; |
| 353 | 355 |
| 354 /* | 356 /* |
| 355 * Get remote CName | 357 * Get remote CName |
| 356 * | 358 * |
| 357 * return -1 on failure else 0 | 359 * return -1 on failure else 0 |
| 358 */ | 360 */ |
| 359 virtual int32_t RemoteCNAME(uint32_t remoteSSRC, | 361 virtual int32_t RemoteCNAME(uint32_t remote_ssrc, |
| 360 char cName[RTCP_CNAME_SIZE]) const = 0; | 362 char cName[RTCP_CNAME_SIZE]) const = 0; |
| 361 | 363 |
| 362 /* | 364 /* |
| 363 * Get remote NTP | 365 * Get remote NTP |
| 364 * | 366 * |
| 365 * return -1 on failure else 0 | 367 * return -1 on failure else 0 |
| 366 */ | 368 */ |
| 367 virtual int32_t RemoteNTP( | 369 virtual int32_t RemoteNTP( |
| 368 uint32_t *ReceivedNTPsecs, | 370 uint32_t *ReceivedNTPsecs, |
| 369 uint32_t *ReceivedNTPfrac, | 371 uint32_t *ReceivedNTPfrac, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 383 * | 385 * |
| 384 * return -1 on failure else 0 | 386 * return -1 on failure else 0 |
| 385 */ | 387 */ |
| 386 virtual int32_t RemoveMixedCNAME(uint32_t SSRC) = 0; | 388 virtual int32_t RemoveMixedCNAME(uint32_t SSRC) = 0; |
| 387 | 389 |
| 388 /* | 390 /* |
| 389 * Get RoundTripTime | 391 * Get RoundTripTime |
| 390 * | 392 * |
| 391 * return -1 on failure else 0 | 393 * return -1 on failure else 0 |
| 392 */ | 394 */ |
| 393 virtual int32_t RTT(uint32_t remoteSSRC, | 395 virtual int32_t RTT(uint32_t remote_ssrc, |
| 394 int64_t* RTT, | 396 int64_t* rtt, |
| 395 int64_t* avgRTT, | 397 int64_t* avg_rtt, |
| 396 int64_t* minRTT, | 398 int64_t* min_rtt, |
| 397 int64_t* maxRTT) const = 0; | 399 int64_t* max_rtt) const = 0; |
| 398 | 400 |
| 399 /* | 401 /* |
| 400 * Force a send of a RTCP packet | 402 * Force a send of a RTCP packet |
| 401 * periodic SR and RR are triggered via the process function | 403 * periodic SR and RR are triggered via the process function |
| 402 * | 404 * |
| 403 * return -1 on failure else 0 | 405 * return -1 on failure else 0 |
| 404 */ | 406 */ |
| 405 virtual int32_t SendRTCP(RTCPPacketType rtcpPacketType) = 0; | 407 virtual int32_t SendRTCP(RTCPPacketType rtcp_packet_type) = 0; |
| 406 | 408 |
| 407 /* | 409 /* |
| 408 * Force a send of a RTCP packet with more than one packet type. | 410 * Force a send of a RTCP packet with more than one packet type. |
| 409 * periodic SR and RR are triggered via the process function | 411 * periodic SR and RR are triggered via the process function |
| 410 * | 412 * |
| 411 * return -1 on failure else 0 | 413 * return -1 on failure else 0 |
| 412 */ | 414 */ |
| 413 virtual int32_t SendCompoundRTCP( | 415 virtual int32_t SendCompoundRTCP( |
| 414 const std::set<RTCPPacketType>& rtcpPacketTypes) = 0; | 416 const std::set<RTCPPacketType>& rtcp_packet_types) = 0; |
| 415 | 417 |
| 416 /* | 418 /* |
| 417 * Good state of RTP receiver inform sender | 419 * Good state of RTP receiver inform sender |
| 418 */ | 420 */ |
| 419 virtual int32_t SendRTCPReferencePictureSelection(uint64_t pictureID) = 0; | 421 virtual int32_t SendRTCPReferencePictureSelection(uint64_t pictureID) = 0; |
| 420 | 422 |
| 421 /* | 423 /* |
| 422 * Send a RTCP Slice Loss Indication (SLI) | 424 * Send a RTCP Slice Loss Indication (SLI) |
| 423 * 6 least significant bits of pictureID | 425 * 6 least significant bits of pictureID |
| 424 */ | 426 */ |
| (...skipping 21 matching lines...) Expand all Loading... |
| 446 virtual void GetRtpPacketLossStats( | 448 virtual void GetRtpPacketLossStats( |
| 447 bool outgoing, | 449 bool outgoing, |
| 448 uint32_t ssrc, | 450 uint32_t ssrc, |
| 449 struct RtpPacketLossStats* loss_stats) const = 0; | 451 struct RtpPacketLossStats* loss_stats) const = 0; |
| 450 | 452 |
| 451 /* | 453 /* |
| 452 * Get received RTCP sender info | 454 * Get received RTCP sender info |
| 453 * | 455 * |
| 454 * return -1 on failure else 0 | 456 * return -1 on failure else 0 |
| 455 */ | 457 */ |
| 456 virtual int32_t RemoteRTCPStat(RTCPSenderInfo* senderInfo) = 0; | 458 virtual int32_t RemoteRTCPStat(RTCPSenderInfo* sender_info) = 0; |
| 457 | 459 |
| 458 /* | 460 /* |
| 459 * Get received RTCP report block | 461 * Get received RTCP report block |
| 460 * | 462 * |
| 461 * return -1 on failure else 0 | 463 * return -1 on failure else 0 |
| 462 */ | 464 */ |
| 463 virtual int32_t RemoteRTCPStat( | 465 virtual int32_t RemoteRTCPStat( |
| 464 std::vector<RTCPReportBlock>* receiveBlocks) const = 0; | 466 std::vector<RTCPReportBlock>* receive_blocks) const = 0; |
| 465 | 467 |
| 466 /* | 468 /* |
| 467 * (APP) Application specific data | 469 * (APP) Application specific data |
| 468 * | 470 * |
| 469 * return -1 on failure else 0 | 471 * return -1 on failure else 0 |
| 470 */ | 472 */ |
| 471 virtual int32_t SetRTCPApplicationSpecificData(uint8_t subType, | 473 virtual int32_t SetRTCPApplicationSpecificData(uint8_t sub_type, |
| 472 uint32_t name, | 474 uint32_t name, |
| 473 const uint8_t* data, | 475 const uint8_t* data, |
| 474 uint16_t length) = 0; | 476 uint16_t length) = 0; |
| 475 /* | 477 /* |
| 476 * (XR) VOIP metric | 478 * (XR) VOIP metric |
| 477 * | 479 * |
| 478 * return -1 on failure else 0 | 480 * return -1 on failure else 0 |
| 479 */ | 481 */ |
| 480 virtual int32_t SetRTCPVoIPMetrics( | 482 virtual int32_t SetRTCPVoIPMetrics( |
| 481 const RTCPVoIPMetric* VoIPMetric) = 0; | 483 const RTCPVoIPMetric* VoIPMetric) = 0; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 virtual int SetSelectiveRetransmissions(uint8_t settings) = 0; | 531 virtual int SetSelectiveRetransmissions(uint8_t settings) = 0; |
| 530 | 532 |
| 531 /* | 533 /* |
| 532 * Send a Negative acknowledgement packet | 534 * Send a Negative acknowledgement packet |
| 533 * | 535 * |
| 534 * return -1 on failure else 0 | 536 * return -1 on failure else 0 |
| 535 */ | 537 */ |
| 536 // TODO(philipel): Deprecate this and start using SendNack instead, | 538 // TODO(philipel): Deprecate this and start using SendNack instead, |
| 537 // mostly because we want a function that actually send | 539 // mostly because we want a function that actually send |
| 538 // NACK for the specified packets. | 540 // NACK for the specified packets. |
| 539 virtual int32_t SendNACK(const uint16_t* nackList, uint16_t size) = 0; | 541 virtual int32_t SendNACK(const uint16_t* nack_list, uint16_t size) = 0; |
| 540 | 542 |
| 541 /* | 543 /* |
| 542 * Send NACK for the packets specified. | 544 * Send NACK for the packets specified. |
| 543 * | 545 * |
| 544 * Note: This assumes the caller keeps track of timing and doesn't rely on | 546 * Note: This assumes the caller keeps track of timing and doesn't rely on |
| 545 * the RTP module to do this. | 547 * the RTP module to do this. |
| 546 */ | 548 */ |
| 547 virtual void SendNack(const std::vector<uint16_t>& sequence_numbers) = 0; | 549 virtual void SendNack(const std::vector<uint16_t>& sequence_numbers) = 0; |
| 548 | 550 |
| 549 /* | 551 /* |
| (...skipping 18 matching lines...) Expand all Loading... |
| 568 * Audio | 570 * Audio |
| 569 * | 571 * |
| 570 ***************************************************************************/ | 572 ***************************************************************************/ |
| 571 | 573 |
| 572 /* | 574 /* |
| 573 * set audio packet size, used to determine when it's time to send a DTMF | 575 * set audio packet size, used to determine when it's time to send a DTMF |
| 574 * packet in silence (CNG) | 576 * packet in silence (CNG) |
| 575 * | 577 * |
| 576 * return -1 on failure else 0 | 578 * return -1 on failure else 0 |
| 577 */ | 579 */ |
| 578 virtual int32_t SetAudioPacketSize(uint16_t packetSizeSamples) = 0; | 580 virtual int32_t SetAudioPacketSize(uint16_t packet_size_samples) = 0; |
| 579 | 581 |
| 580 /* | 582 /* |
| 581 * Send a TelephoneEvent tone using RFC 2833 (4733) | 583 * Send a TelephoneEvent tone using RFC 2833 (4733) |
| 582 * | 584 * |
| 583 * return -1 on failure else 0 | 585 * return -1 on failure else 0 |
| 584 */ | 586 */ |
| 585 virtual int32_t SendTelephoneEventOutband(uint8_t key, | 587 virtual int32_t SendTelephoneEventOutband(uint8_t key, |
| 586 uint16_t time_ms, | 588 uint16_t time_ms, |
| 587 uint8_t level) = 0; | 589 uint8_t level) = 0; |
| 588 | 590 |
| 589 /* | 591 /* |
| 590 * Set payload type for Redundant Audio Data RFC 2198 | 592 * Set payload type for Redundant Audio Data RFC 2198 |
| 591 * | 593 * |
| 592 * return -1 on failure else 0 | 594 * return -1 on failure else 0 |
| 593 */ | 595 */ |
| 594 virtual int32_t SetSendREDPayloadType(int8_t payloadType) = 0; | 596 virtual int32_t SetSendREDPayloadType(int8_t payload_type) = 0; |
| 595 | 597 |
| 596 /* | 598 /* |
| 597 * Get payload type for Redundant Audio Data RFC 2198 | 599 * Get payload type for Redundant Audio Data RFC 2198 |
| 598 * | 600 * |
| 599 * return -1 on failure else 0 | 601 * return -1 on failure else 0 |
| 600 */ | 602 */ |
| 601 virtual int32_t SendREDPayloadType(int8_t* payload_type) const = 0; | 603 virtual int32_t SendREDPayloadType(int8_t* payload_type) const = 0; |
| 602 /* | 604 /* |
| 603 * Store the audio level in dBov for header-extension-for-audio-level- | 605 * Store the audio level in dBov for header-extension-for-audio-level- |
| 604 * indication. | 606 * indication. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 | 649 |
| 648 /* | 650 /* |
| 649 * send a request for a keyframe | 651 * send a request for a keyframe |
| 650 * | 652 * |
| 651 * return -1 on failure else 0 | 653 * return -1 on failure else 0 |
| 652 */ | 654 */ |
| 653 virtual int32_t RequestKeyFrame() = 0; | 655 virtual int32_t RequestKeyFrame() = 0; |
| 654 }; | 656 }; |
| 655 } // namespace webrtc | 657 } // namespace webrtc |
| 656 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_RTCP_H_ | 658 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_RTCP_H_ |
| OLD | NEW |