Line data Source code
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 : struct CodecInst;
20 : class RTPPayloadRegistry;
21 : class VideoCodec;
22 :
23 0 : class TelephoneEventHandler {
24 : public:
25 0 : virtual ~TelephoneEventHandler() {}
26 :
27 : // The following three methods implement the TelephoneEventHandler interface.
28 : // Forward DTMFs to decoder for playout.
29 : virtual void SetTelephoneEventForwardToDecoder(bool forward_to_decoder) = 0;
30 :
31 : // Is forwarding of outband telephone events turned on/off?
32 : virtual bool TelephoneEventForwardToDecoder() const = 0;
33 :
34 : // Is TelephoneEvent configured with payload type payload_type
35 : virtual bool TelephoneEventPayloadType(const int8_t payload_type) const = 0;
36 : };
37 :
38 0 : class RtpReceiver {
39 : public:
40 : // Creates a video-enabled RTP receiver.
41 : static RtpReceiver* CreateVideoReceiver(
42 : Clock* clock,
43 : RtpData* incoming_payload_callback,
44 : RtpFeedback* incoming_messages_callback,
45 : RTPPayloadRegistry* rtp_payload_registry);
46 :
47 : // Creates an audio-enabled RTP receiver.
48 : static RtpReceiver* CreateAudioReceiver(
49 : Clock* clock,
50 : RtpData* incoming_payload_callback,
51 : RtpFeedback* incoming_messages_callback,
52 : RTPPayloadRegistry* rtp_payload_registry);
53 :
54 0 : virtual ~RtpReceiver() {}
55 :
56 : // Returns a TelephoneEventHandler if available.
57 : virtual TelephoneEventHandler* GetTelephoneEventHandler() = 0;
58 :
59 : // Registers a receive payload in the payload registry and notifies the media
60 : // receiver strategy.
61 : virtual int32_t RegisterReceivePayload(const CodecInst& audio_codec) = 0;
62 : // Registers a receive payload in the payload registry.
63 : virtual int32_t RegisterReceivePayload(const VideoCodec& video_codec) = 0;
64 :
65 : // De-registers |payload_type| from the payload registry.
66 : virtual int32_t DeRegisterReceivePayload(const int8_t payload_type) = 0;
67 :
68 : // Parses the media specific parts of an RTP packet and updates the receiver
69 : // state. This for instance means that any changes in SSRC and payload type is
70 : // detected and acted upon.
71 : virtual bool IncomingRtpPacket(const RTPHeader& rtp_header,
72 : const uint8_t* payload,
73 : size_t payload_length,
74 : PayloadUnion payload_specific,
75 : bool in_order) = 0;
76 :
77 : // Gets the last received timestamp. Returns true if a packet has been
78 : // received, false otherwise.
79 : virtual bool Timestamp(uint32_t* timestamp) const = 0;
80 : // Gets the time in milliseconds when the last timestamp was received.
81 : // Returns true if a packet has been received, false otherwise.
82 : virtual bool LastReceivedTimeMs(int64_t* receive_time_ms) const = 0;
83 :
84 : // Returns the remote SSRC of the currently received RTP stream.
85 : virtual uint32_t SSRC() const = 0;
86 :
87 : // Returns the current remote CSRCs.
88 : virtual int32_t CSRCs(uint32_t array_of_csrc[kRtpCsrcSize]) const = 0;
89 :
90 : virtual void GetRID(char rid[256]) const = 0;
91 :
92 : // Returns the current energy of the RTP stream received.
93 : virtual int32_t Energy(uint8_t array_of_energy[kRtpCsrcSize]) const = 0;
94 : };
95 : } // namespace webrtc
96 :
97 : #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_RECEIVER_H_
|