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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 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 uint8_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 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 bool IsRed(const RTPHeader& header) const; | 103 bool IsRed(const RTPHeader& header) const; |
104 | 104 |
105 // Returns true if the media of this RTP packet is encapsulated within an | 105 // Returns true if the media of this RTP packet is encapsulated within an |
106 // extra header, such as RTX or RED. | 106 // extra header, such as RTX or RED. |
107 bool IsEncapsulated(const RTPHeader& header) const; | 107 bool IsEncapsulated(const RTPHeader& header) const; |
108 | 108 |
109 bool GetPayloadSpecifics(uint8_t payload_type, PayloadUnion* payload) const; | 109 bool GetPayloadSpecifics(uint8_t payload_type, PayloadUnion* payload) const; |
110 | 110 |
111 int GetPayloadTypeFrequency(uint8_t payload_type) const; | 111 int GetPayloadTypeFrequency(uint8_t payload_type) const; |
112 | 112 |
| 113 // DEPRECATED. Use PayloadTypeToPayload below that returns const Payload* |
| 114 // instead of taking output parameter. |
| 115 // TODO(danilchap): Remove this when all callers have been updated. |
113 bool PayloadTypeToPayload(const uint8_t payload_type, | 116 bool PayloadTypeToPayload(const uint8_t payload_type, |
114 RtpUtility::Payload*& payload) const; | 117 RtpUtility::Payload*& payload) const { // NOLINT |
| 118 payload = |
| 119 const_cast<RtpUtility::Payload*>(PayloadTypeToPayload(payload_type)); |
| 120 return payload != nullptr; |
| 121 } |
| 122 const RtpUtility::Payload* PayloadTypeToPayload(uint8_t payload_type) const; |
115 | 123 |
116 void ResetLastReceivedPayloadTypes() { | 124 void ResetLastReceivedPayloadTypes() { |
117 CriticalSectionScoped cs(crit_sect_.get()); | 125 CriticalSectionScoped cs(crit_sect_.get()); |
118 last_received_payload_type_ = -1; | 126 last_received_payload_type_ = -1; |
119 last_received_media_payload_type_ = -1; | 127 last_received_media_payload_type_ = -1; |
120 } | 128 } |
121 | 129 |
122 // This sets the payload type of the packets being received from the network | 130 // This sets the payload type of the packets being received from the network |
123 // on the media SSRC. For instance if packets are encapsulated with RED, this | 131 // on the media SSRC. For instance if packets are encapsulated with RED, this |
124 // payload type will be the RED payload type. | 132 // payload type will be the RED payload type. |
(...skipping 15 matching lines...) Expand all Loading... |
140 return last_received_payload_type_; | 148 return last_received_payload_type_; |
141 } | 149 } |
142 void set_last_received_payload_type(int8_t last_received_payload_type) { | 150 void set_last_received_payload_type(int8_t last_received_payload_type) { |
143 CriticalSectionScoped cs(crit_sect_.get()); | 151 CriticalSectionScoped cs(crit_sect_.get()); |
144 last_received_payload_type_ = last_received_payload_type; | 152 last_received_payload_type_ = last_received_payload_type; |
145 } | 153 } |
146 | 154 |
147 int8_t last_received_media_payload_type() const { | 155 int8_t last_received_media_payload_type() const { |
148 CriticalSectionScoped cs(crit_sect_.get()); | 156 CriticalSectionScoped cs(crit_sect_.get()); |
149 return last_received_media_payload_type_; | 157 return last_received_media_payload_type_; |
150 }; | 158 } |
151 | 159 |
152 bool use_rtx_payload_mapping_on_restore() const { | 160 bool use_rtx_payload_mapping_on_restore() const { |
153 CriticalSectionScoped cs(crit_sect_.get()); | 161 CriticalSectionScoped cs(crit_sect_.get()); |
154 return use_rtx_payload_mapping_on_restore_; | 162 return use_rtx_payload_mapping_on_restore_; |
155 } | 163 } |
156 | 164 |
157 void set_use_rtx_payload_mapping_on_restore(bool val) { | 165 void set_use_rtx_payload_mapping_on_restore(bool val) { |
158 CriticalSectionScoped cs(crit_sect_.get()); | 166 CriticalSectionScoped cs(crit_sect_.get()); |
159 use_rtx_payload_mapping_on_restore_ = val; | 167 use_rtx_payload_mapping_on_restore_ = val; |
160 } | 168 } |
(...skipping 25 matching lines...) Expand all Loading... |
186 std::map<int, int> rtx_payload_type_map_; | 194 std::map<int, int> rtx_payload_type_map_; |
187 // 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 |
188 // correct payload type. | 196 // correct payload type. |
189 bool use_rtx_payload_mapping_on_restore_; | 197 bool use_rtx_payload_mapping_on_restore_; |
190 uint32_t ssrc_rtx_; | 198 uint32_t ssrc_rtx_; |
191 }; | 199 }; |
192 | 200 |
193 } // namespace webrtc | 201 } // namespace webrtc |
194 | 202 |
195 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_PAYLOAD_REGISTRY_H_ | 203 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_PAYLOAD_REGISTRY_H_ |
OLD | NEW |