OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 20 matching lines...) Expand all Loading... |
31 virtual bool CodecsMustBeUnique() const = 0; | 31 virtual bool CodecsMustBeUnique() const = 0; |
32 | 32 |
33 virtual bool PayloadIsCompatible(const RtpUtility::Payload& payload, | 33 virtual bool PayloadIsCompatible(const RtpUtility::Payload& payload, |
34 uint32_t frequency, | 34 uint32_t frequency, |
35 size_t channels, | 35 size_t channels, |
36 uint32_t rate) const = 0; | 36 uint32_t rate) const = 0; |
37 | 37 |
38 virtual void UpdatePayloadRate(RtpUtility::Payload* payload, | 38 virtual void UpdatePayloadRate(RtpUtility::Payload* payload, |
39 uint32_t rate) const = 0; | 39 uint32_t rate) const = 0; |
40 | 40 |
41 virtual RtpUtility::Payload* CreatePayloadType( | 41 virtual RtpUtility::Payload* CreatePayloadType(const char* payload_name, |
42 const char payload_name[RTP_PAYLOAD_NAME_SIZE], | 42 int8_t payload_type, |
43 int8_t payload_type, | 43 uint32_t frequency, |
44 uint32_t frequency, | 44 size_t channels, |
45 size_t channels, | 45 uint32_t rate) const = 0; |
46 uint32_t rate) const = 0; | |
47 | 46 |
48 virtual int GetPayloadTypeFrequency( | 47 virtual int GetPayloadTypeFrequency( |
49 const RtpUtility::Payload& payload) const = 0; | 48 const RtpUtility::Payload& payload) const = 0; |
50 | 49 |
51 static RTPPayloadStrategy* CreateStrategy(bool handling_audio); | 50 static RTPPayloadStrategy* CreateStrategy(bool handling_audio); |
52 | 51 |
53 protected: | 52 protected: |
54 RTPPayloadStrategy() {} | 53 RTPPayloadStrategy() {} |
55 }; | 54 }; |
56 | 55 |
57 class RTPPayloadRegistry { | 56 class RTPPayloadRegistry { |
58 public: | 57 public: |
59 // The registry takes ownership of the strategy. | 58 // The registry takes ownership of the strategy. |
60 explicit RTPPayloadRegistry(RTPPayloadStrategy* rtp_payload_strategy); | 59 explicit RTPPayloadRegistry(RTPPayloadStrategy* rtp_payload_strategy); |
61 ~RTPPayloadRegistry(); | 60 ~RTPPayloadRegistry(); |
62 | 61 |
63 int32_t RegisterReceivePayload(const char payload_name[RTP_PAYLOAD_NAME_SIZE], | 62 int32_t RegisterReceivePayload(const char* payload_name, |
64 int8_t payload_type, | 63 int8_t payload_type, |
65 uint32_t frequency, | 64 uint32_t frequency, |
66 size_t channels, | 65 size_t channels, |
67 uint32_t rate, | 66 uint32_t rate, |
68 bool* created_new_payload_type); | 67 bool* created_new_payload_type); |
69 | 68 |
70 int32_t DeRegisterReceivePayload(int8_t payload_type); | 69 int32_t DeRegisterReceivePayload(int8_t payload_type); |
71 | 70 |
72 int32_t ReceivePayloadType(const char payload_name[RTP_PAYLOAD_NAME_SIZE], | 71 int32_t ReceivePayloadType(const char* payload_name, |
73 uint32_t frequency, | 72 uint32_t frequency, |
74 size_t channels, | 73 size_t channels, |
75 uint32_t rate, | 74 uint32_t rate, |
76 int8_t* payload_type) const; | 75 int8_t* payload_type) const; |
77 | 76 |
78 bool RtxEnabled() const; | 77 bool RtxEnabled() const; |
79 | 78 |
80 void SetRtxSsrc(uint32_t ssrc); | 79 void SetRtxSsrc(uint32_t ssrc); |
81 | 80 |
82 bool GetRtxSsrc(uint32_t* ssrc) const; | 81 bool GetRtxSsrc(uint32_t* ssrc) const; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 int8_t last_received_media_payload_type() const { | 136 int8_t last_received_media_payload_type() const { |
138 rtc::CritScope cs(&crit_sect_); | 137 rtc::CritScope cs(&crit_sect_); |
139 return last_received_media_payload_type_; | 138 return last_received_media_payload_type_; |
140 } | 139 } |
141 | 140 |
142 RTC_DEPRECATED void set_use_rtx_payload_mapping_on_restore(bool val) {} | 141 RTC_DEPRECATED void set_use_rtx_payload_mapping_on_restore(bool val) {} |
143 | 142 |
144 private: | 143 private: |
145 // Prunes the payload type map of the specific payload type, if it exists. | 144 // Prunes the payload type map of the specific payload type, if it exists. |
146 void DeregisterAudioCodecOrRedTypeRegardlessOfPayloadType( | 145 void DeregisterAudioCodecOrRedTypeRegardlessOfPayloadType( |
147 const char payload_name[RTP_PAYLOAD_NAME_SIZE], | 146 const char* payload_name, |
148 size_t payload_name_length, | 147 size_t payload_name_length, |
149 uint32_t frequency, | 148 uint32_t frequency, |
150 size_t channels, | 149 size_t channels, |
151 uint32_t rate); | 150 uint32_t rate); |
152 | 151 |
153 bool IsRtxInternal(const RTPHeader& header) const; | 152 bool IsRtxInternal(const RTPHeader& header) const; |
154 | 153 |
155 rtc::CriticalSection crit_sect_; | 154 rtc::CriticalSection crit_sect_; |
156 RtpUtility::PayloadTypeMap payload_type_map_; | 155 RtpUtility::PayloadTypeMap payload_type_map_; |
157 std::unique_ptr<RTPPayloadStrategy> rtp_payload_strategy_; | 156 std::unique_ptr<RTPPayloadStrategy> rtp_payload_strategy_; |
158 int8_t red_payload_type_; | 157 int8_t red_payload_type_; |
159 int8_t ulpfec_payload_type_; | 158 int8_t ulpfec_payload_type_; |
160 int8_t incoming_payload_type_; | 159 int8_t incoming_payload_type_; |
161 int8_t last_received_payload_type_; | 160 int8_t last_received_payload_type_; |
162 int8_t last_received_media_payload_type_; | 161 int8_t last_received_media_payload_type_; |
163 bool rtx_; | 162 bool rtx_; |
164 // Mapping rtx_payload_type_map_[rtx] = associated. | 163 // Mapping rtx_payload_type_map_[rtx] = associated. |
165 std::map<int, int> rtx_payload_type_map_; | 164 std::map<int, int> rtx_payload_type_map_; |
166 uint32_t ssrc_rtx_; | 165 uint32_t ssrc_rtx_; |
167 // Only warn once per payload type, if an RTX packet is received but | 166 // Only warn once per payload type, if an RTX packet is received but |
168 // no associated payload type found in |rtx_payload_type_map_|. | 167 // no associated payload type found in |rtx_payload_type_map_|. |
169 std::set<int> payload_types_with_suppressed_warnings_ GUARDED_BY(crit_sect_); | 168 std::set<int> payload_types_with_suppressed_warnings_ GUARDED_BY(crit_sect_); |
170 }; | 169 }; |
171 | 170 |
172 } // namespace webrtc | 171 } // namespace webrtc |
173 | 172 |
174 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_PAYLOAD_REGISTRY_H_ | 173 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_PAYLOAD_REGISTRY_H_ |
OLD | NEW |