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 |
11 #ifndef WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_PAYLOAD_REGISTRY_H_ | 11 #ifndef WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_PAYLOAD_REGISTRY_H_ |
12 #define WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_PAYLOAD_REGISTRY_H_ | 12 #define WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_PAYLOAD_REGISTRY_H_ |
13 | 13 |
14 #include <map> | |
15 | |
14 #include "webrtc/base/scoped_ptr.h" | 16 #include "webrtc/base/scoped_ptr.h" |
15 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h" | 17 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h" |
16 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 18 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
17 | 19 |
18 namespace webrtc { | 20 namespace webrtc { |
19 | 21 |
20 // This strategy deals with the audio/video-specific aspects | 22 // This strategy deals with the audio/video-specific aspects |
21 // of payload handling. | 23 // of payload handling. |
22 class RTPPayloadStrategy { | 24 class RTPPayloadStrategy { |
23 public: | 25 public: |
(...skipping 21 matching lines...) Expand all Loading... | |
45 | 47 |
46 static RTPPayloadStrategy* CreateStrategy(const bool handling_audio); | 48 static RTPPayloadStrategy* CreateStrategy(const bool handling_audio); |
47 | 49 |
48 protected: | 50 protected: |
49 RTPPayloadStrategy() {} | 51 RTPPayloadStrategy() {} |
50 }; | 52 }; |
51 | 53 |
52 class RTPPayloadRegistry { | 54 class RTPPayloadRegistry { |
53 public: | 55 public: |
54 // The registry takes ownership of the strategy. | 56 // The registry takes ownership of the strategy. |
55 RTPPayloadRegistry(RTPPayloadStrategy* rtp_payload_strategy); | 57 explicit RTPPayloadRegistry(RTPPayloadStrategy* rtp_payload_strategy); |
56 ~RTPPayloadRegistry(); | 58 ~RTPPayloadRegistry(); |
57 | 59 |
58 int32_t RegisterReceivePayload( | 60 int32_t RegisterReceivePayload( |
59 const char payload_name[RTP_PAYLOAD_NAME_SIZE], | 61 const char payload_name[RTP_PAYLOAD_NAME_SIZE], |
60 const int8_t payload_type, | 62 const int8_t payload_type, |
61 const uint32_t frequency, | 63 const uint32_t frequency, |
62 const uint8_t channels, | 64 const uint8_t channels, |
63 const uint32_t rate, | 65 const uint32_t rate, |
64 bool* created_new_payload_type); | 66 bool* created_new_payload_type); |
65 | 67 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 bool IsRed(const RTPHeader& header) const; | 103 bool IsRed(const RTPHeader& header) const; |
102 | 104 |
103 // 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 |
104 // extra header, such as RTX or RED. | 106 // extra header, such as RTX or RED. |
105 bool IsEncapsulated(const RTPHeader& header) const; | 107 bool IsEncapsulated(const RTPHeader& header) const; |
106 | 108 |
107 bool GetPayloadSpecifics(uint8_t payload_type, PayloadUnion* payload) const; | 109 bool GetPayloadSpecifics(uint8_t payload_type, PayloadUnion* payload) const; |
108 | 110 |
109 int GetPayloadTypeFrequency(uint8_t payload_type) const; | 111 int GetPayloadTypeFrequency(uint8_t payload_type) const; |
110 | 112 |
113 // Depricated. | |
mflodman
2015/12/09 09:19:13
Here and elsewhere:
s/depricated/deprecated
danilchap
2015/12/09 11:23:36
Done.
| |
111 bool PayloadTypeToPayload(const uint8_t payload_type, | 114 bool PayloadTypeToPayload(const uint8_t payload_type, |
112 RtpUtility::Payload*& payload) const; | 115 RtpUtility::Payload*& payload) const { // NOLINT |
116 payload = PayloadTypeToPayload(payload_type); | |
117 return (payload != nullptr); | |
118 } | |
119 RtpUtility::Payload* PayloadTypeToPayload(uint8_t payload_type) const; | |
113 | 120 |
114 void ResetLastReceivedPayloadTypes() { | 121 void ResetLastReceivedPayloadTypes() { |
115 CriticalSectionScoped cs(crit_sect_.get()); | 122 CriticalSectionScoped cs(crit_sect_.get()); |
116 last_received_payload_type_ = -1; | 123 last_received_payload_type_ = -1; |
117 last_received_media_payload_type_ = -1; | 124 last_received_media_payload_type_ = -1; |
118 } | 125 } |
119 | 126 |
120 // This sets the payload type of the packets being received from the network | 127 // This sets the payload type of the packets being received from the network |
121 // on the media SSRC. For instance if packets are encapsulated with RED, this | 128 // on the media SSRC. For instance if packets are encapsulated with RED, this |
122 // payload type will be the RED payload type. | 129 // payload type will be the RED payload type. |
(...skipping 15 matching lines...) Expand all Loading... | |
138 return last_received_payload_type_; | 145 return last_received_payload_type_; |
139 } | 146 } |
140 void set_last_received_payload_type(int8_t last_received_payload_type) { | 147 void set_last_received_payload_type(int8_t last_received_payload_type) { |
141 CriticalSectionScoped cs(crit_sect_.get()); | 148 CriticalSectionScoped cs(crit_sect_.get()); |
142 last_received_payload_type_ = last_received_payload_type; | 149 last_received_payload_type_ = last_received_payload_type; |
143 } | 150 } |
144 | 151 |
145 int8_t last_received_media_payload_type() const { | 152 int8_t last_received_media_payload_type() const { |
146 CriticalSectionScoped cs(crit_sect_.get()); | 153 CriticalSectionScoped cs(crit_sect_.get()); |
147 return last_received_media_payload_type_; | 154 return last_received_media_payload_type_; |
148 }; | 155 } |
149 | 156 |
150 bool use_rtx_payload_mapping_on_restore() const { | 157 bool use_rtx_payload_mapping_on_restore() const { |
151 CriticalSectionScoped cs(crit_sect_.get()); | 158 CriticalSectionScoped cs(crit_sect_.get()); |
152 return use_rtx_payload_mapping_on_restore_; | 159 return use_rtx_payload_mapping_on_restore_; |
153 } | 160 } |
154 | 161 |
155 void set_use_rtx_payload_mapping_on_restore(bool val) { | 162 void set_use_rtx_payload_mapping_on_restore(bool val) { |
156 CriticalSectionScoped cs(crit_sect_.get()); | 163 CriticalSectionScoped cs(crit_sect_.get()); |
157 use_rtx_payload_mapping_on_restore_ = val; | 164 use_rtx_payload_mapping_on_restore_ = val; |
158 } | 165 } |
(...skipping 25 matching lines...) Expand all Loading... | |
184 std::map<int, int> rtx_payload_type_map_; | 191 std::map<int, int> rtx_payload_type_map_; |
185 // When true, use rtx_payload_type_map_ when restoring RTX packets to get the | 192 // When true, use rtx_payload_type_map_ when restoring RTX packets to get the |
186 // correct payload type. | 193 // correct payload type. |
187 bool use_rtx_payload_mapping_on_restore_; | 194 bool use_rtx_payload_mapping_on_restore_; |
188 uint32_t ssrc_rtx_; | 195 uint32_t ssrc_rtx_; |
189 }; | 196 }; |
190 | 197 |
191 } // namespace webrtc | 198 } // namespace webrtc |
192 | 199 |
193 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_PAYLOAD_REGISTRY_H_ | 200 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_PAYLOAD_REGISTRY_H_ |
OLD | NEW |