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 11 matching lines...) Expand all Loading... |
22 // This strategy deals with the audio/video-specific aspects | 22 // This strategy deals with the audio/video-specific aspects |
23 // of payload handling. | 23 // of payload handling. |
24 class RTPPayloadStrategy { | 24 class RTPPayloadStrategy { |
25 public: | 25 public: |
26 virtual ~RTPPayloadStrategy() {} | 26 virtual ~RTPPayloadStrategy() {} |
27 | 27 |
28 virtual bool CodecsMustBeUnique() const = 0; | 28 virtual bool CodecsMustBeUnique() const = 0; |
29 | 29 |
30 virtual bool PayloadIsCompatible(const RtpUtility::Payload& payload, | 30 virtual bool PayloadIsCompatible(const RtpUtility::Payload& payload, |
31 const uint32_t frequency, | 31 const uint32_t frequency, |
32 const uint8_t channels, | 32 const size_t channels, |
33 const uint32_t rate) const = 0; | 33 const uint32_t rate) const = 0; |
34 | 34 |
35 virtual void UpdatePayloadRate(RtpUtility::Payload* payload, | 35 virtual void UpdatePayloadRate(RtpUtility::Payload* payload, |
36 const uint32_t rate) const = 0; | 36 const uint32_t rate) const = 0; |
37 | 37 |
38 virtual RtpUtility::Payload* CreatePayloadType( | 38 virtual RtpUtility::Payload* CreatePayloadType( |
39 const char payloadName[RTP_PAYLOAD_NAME_SIZE], | 39 const char payloadName[RTP_PAYLOAD_NAME_SIZE], |
40 const int8_t payloadType, | 40 const int8_t payloadType, |
41 const uint32_t frequency, | 41 const uint32_t frequency, |
42 const uint8_t channels, | 42 const size_t channels, |
43 const uint32_t rate) const = 0; | 43 const uint32_t rate) const = 0; |
44 | 44 |
45 virtual int GetPayloadTypeFrequency( | 45 virtual int GetPayloadTypeFrequency( |
46 const RtpUtility::Payload& payload) const = 0; | 46 const RtpUtility::Payload& payload) const = 0; |
47 | 47 |
48 static RTPPayloadStrategy* CreateStrategy(const bool handling_audio); | 48 static RTPPayloadStrategy* CreateStrategy(const bool handling_audio); |
49 | 49 |
50 protected: | 50 protected: |
51 RTPPayloadStrategy() {} | 51 RTPPayloadStrategy() {} |
52 }; | 52 }; |
53 | 53 |
54 class RTPPayloadRegistry { | 54 class RTPPayloadRegistry { |
55 public: | 55 public: |
56 // The registry takes ownership of the strategy. | 56 // The registry takes ownership of the strategy. |
57 explicit RTPPayloadRegistry(RTPPayloadStrategy* rtp_payload_strategy); | 57 explicit RTPPayloadRegistry(RTPPayloadStrategy* rtp_payload_strategy); |
58 ~RTPPayloadRegistry(); | 58 ~RTPPayloadRegistry(); |
59 | 59 |
60 int32_t RegisterReceivePayload( | 60 int32_t RegisterReceivePayload( |
61 const char payload_name[RTP_PAYLOAD_NAME_SIZE], | 61 const char payload_name[RTP_PAYLOAD_NAME_SIZE], |
62 const int8_t payload_type, | 62 const int8_t payload_type, |
63 const uint32_t frequency, | 63 const uint32_t frequency, |
64 const uint8_t channels, | 64 const size_t channels, |
65 const uint32_t rate, | 65 const uint32_t rate, |
66 bool* created_new_payload_type); | 66 bool* created_new_payload_type); |
67 | 67 |
68 int32_t DeRegisterReceivePayload( | 68 int32_t DeRegisterReceivePayload( |
69 const int8_t payload_type); | 69 const int8_t payload_type); |
70 | 70 |
71 int32_t ReceivePayloadType( | 71 int32_t ReceivePayloadType( |
72 const char payload_name[RTP_PAYLOAD_NAME_SIZE], | 72 const char payload_name[RTP_PAYLOAD_NAME_SIZE], |
73 const uint32_t frequency, | 73 const uint32_t frequency, |
74 const uint8_t channels, | 74 const size_t channels, |
75 const uint32_t rate, | 75 const uint32_t rate, |
76 int8_t* payload_type) const; | 76 int8_t* payload_type) const; |
77 | 77 |
78 bool RtxEnabled() const; | 78 bool RtxEnabled() const; |
79 | 79 |
80 void SetRtxSsrc(uint32_t ssrc); | 80 void SetRtxSsrc(uint32_t ssrc); |
81 | 81 |
82 bool GetRtxSsrc(uint32_t* ssrc) const; | 82 bool GetRtxSsrc(uint32_t* ssrc) const; |
83 | 83 |
84 void SetRtxPayloadType(int payload_type, int associated_payload_type); | 84 void SetRtxPayloadType(int payload_type, int associated_payload_type); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 CriticalSectionScoped cs(crit_sect_.get()); | 166 CriticalSectionScoped cs(crit_sect_.get()); |
167 use_rtx_payload_mapping_on_restore_ = val; | 167 use_rtx_payload_mapping_on_restore_ = val; |
168 } | 168 } |
169 | 169 |
170 private: | 170 private: |
171 // Prunes the payload type map of the specific payload type, if it exists. | 171 // Prunes the payload type map of the specific payload type, if it exists. |
172 void DeregisterAudioCodecOrRedTypeRegardlessOfPayloadType( | 172 void DeregisterAudioCodecOrRedTypeRegardlessOfPayloadType( |
173 const char payload_name[RTP_PAYLOAD_NAME_SIZE], | 173 const char payload_name[RTP_PAYLOAD_NAME_SIZE], |
174 const size_t payload_name_length, | 174 const size_t payload_name_length, |
175 const uint32_t frequency, | 175 const uint32_t frequency, |
176 const uint8_t channels, | 176 const size_t channels, |
177 const uint32_t rate); | 177 const uint32_t rate); |
178 | 178 |
179 bool IsRtxInternal(const RTPHeader& header) const; | 179 bool IsRtxInternal(const RTPHeader& header) const; |
180 | 180 |
181 rtc::scoped_ptr<CriticalSectionWrapper> crit_sect_; | 181 rtc::scoped_ptr<CriticalSectionWrapper> crit_sect_; |
182 RtpUtility::PayloadTypeMap payload_type_map_; | 182 RtpUtility::PayloadTypeMap payload_type_map_; |
183 rtc::scoped_ptr<RTPPayloadStrategy> rtp_payload_strategy_; | 183 rtc::scoped_ptr<RTPPayloadStrategy> rtp_payload_strategy_; |
184 int8_t red_payload_type_; | 184 int8_t red_payload_type_; |
185 int8_t ulpfec_payload_type_; | 185 int8_t ulpfec_payload_type_; |
186 int8_t incoming_payload_type_; | 186 int8_t incoming_payload_type_; |
187 int8_t last_received_payload_type_; | 187 int8_t last_received_payload_type_; |
188 int8_t last_received_media_payload_type_; | 188 int8_t last_received_media_payload_type_; |
189 bool rtx_; | 189 bool rtx_; |
190 // TODO(changbin): Remove rtx_payload_type_ once interop with old clients that | 190 // TODO(changbin): Remove rtx_payload_type_ once interop with old clients that |
191 // only understand one RTX PT is no longer needed. | 191 // only understand one RTX PT is no longer needed. |
192 int rtx_payload_type_; | 192 int rtx_payload_type_; |
193 // Mapping rtx_payload_type_map_[rtx] = associated. | 193 // Mapping rtx_payload_type_map_[rtx] = associated. |
194 std::map<int, int> rtx_payload_type_map_; | 194 std::map<int, int> rtx_payload_type_map_; |
195 // When true, use rtx_payload_type_map_ when restoring RTX packets to get the | 195 // When true, use rtx_payload_type_map_ when restoring RTX packets to get the |
196 // correct payload type. | 196 // correct payload type. |
197 bool use_rtx_payload_mapping_on_restore_; | 197 bool use_rtx_payload_mapping_on_restore_; |
198 uint32_t ssrc_rtx_; | 198 uint32_t ssrc_rtx_; |
199 }; | 199 }; |
200 | 200 |
201 } // namespace webrtc | 201 } // namespace webrtc |
202 | 202 |
203 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_PAYLOAD_REGISTRY_H_ | 203 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_PAYLOAD_REGISTRY_H_ |
OLD | NEW |