Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #ifndef WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_RECEIVER_H_ |
| 12 | #define WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_RECEIVER_H_ |
| 13 | |
| 14 | #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 15 | #include "webrtc/typedefs.h" |
| 16 | |
| 17 | namespace webrtc { |
| 18 | |
| 19 | class RTPPayloadRegistry; |
| 20 | |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 21 | class RtpReceiver { |
| 22 | public: |
| 23 | // Creates a video-enabled RTP receiver. |
| 24 | static RtpReceiver* CreateVideoReceiver( |
| 25 | Clock* clock, |
| 26 | RtpData* incoming_payload_callback, |
| 27 | RtpFeedback* incoming_messages_callback, |
| 28 | RTPPayloadRegistry* rtp_payload_registry); |
| 29 | |
| 30 | // Creates an audio-enabled RTP receiver. |
| 31 | static RtpReceiver* CreateAudioReceiver( |
| 32 | Clock* clock, |
solenberg | 1d03139 | 2016-03-30 02:42:32 -0700 | [diff] [blame] | 33 | RtpData* incoming_payload_callback, |
| 34 | RtpFeedback* incoming_messages_callback, |
| 35 | RTPPayloadRegistry* rtp_payload_registry); |
| 36 | |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 37 | virtual ~RtpReceiver() {} |
| 38 | |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 39 | // Registers a receive payload in the payload registry and notifies the media |
| 40 | // receiver strategy. |
| 41 | virtual int32_t RegisterReceivePayload( |
| 42 | const char payload_name[RTP_PAYLOAD_NAME_SIZE], |
| 43 | const int8_t payload_type, |
| 44 | const uint32_t frequency, |
Peter Kasting | 6955870 | 2016-01-12 16:26:35 -0800 | [diff] [blame] | 45 | const size_t channels, |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 46 | const uint32_t rate) = 0; |
| 47 | |
| 48 | // De-registers |payload_type| from the payload registry. |
| 49 | virtual int32_t DeRegisterReceivePayload(const int8_t payload_type) = 0; |
| 50 | |
| 51 | // Parses the media specific parts of an RTP packet and updates the receiver |
| 52 | // state. This for instance means that any changes in SSRC and payload type is |
| 53 | // detected and acted upon. |
| 54 | virtual bool IncomingRtpPacket(const RTPHeader& rtp_header, |
| 55 | const uint8_t* payload, |
| 56 | size_t payload_length, |
| 57 | PayloadUnion payload_specific, |
| 58 | bool in_order) = 0; |
| 59 | |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 60 | // Gets the last received timestamp. Returns true if a packet has been |
| 61 | // received, false otherwise. |
| 62 | virtual bool Timestamp(uint32_t* timestamp) const = 0; |
| 63 | // Gets the time in milliseconds when the last timestamp was received. |
| 64 | // Returns true if a packet has been received, false otherwise. |
| 65 | virtual bool LastReceivedTimeMs(int64_t* receive_time_ms) const = 0; |
| 66 | |
| 67 | // Returns the remote SSRC of the currently received RTP stream. |
| 68 | virtual uint32_t SSRC() const = 0; |
| 69 | |
| 70 | // Returns the current remote CSRCs. |
| 71 | virtual int32_t CSRCs(uint32_t array_of_csrc[kRtpCsrcSize]) const = 0; |
| 72 | |
| 73 | // Returns the current energy of the RTP stream received. |
| 74 | virtual int32_t Energy(uint8_t array_of_energy[kRtpCsrcSize]) const = 0; |
| 75 | }; |
| 76 | } // namespace webrtc |
| 77 | |
| 78 | #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_RECEIVER_H_ |