Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h

Issue 2523843002: Send audio and video codecs to RTPPayloadRegistry (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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> 14 #include <map>
15 #include <memory> 15 #include <memory>
16 #include <set> 16 #include <set>
17 17
18 #include "webrtc/base/criticalsection.h" 18 #include "webrtc/base/criticalsection.h"
19 #include "webrtc/base/deprecation.h" 19 #include "webrtc/base/deprecation.h"
20 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h" 20 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h"
21 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" 21 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
22 22
23 namespace webrtc { 23 namespace webrtc {
24 24
danilchap 2016/11/23 15:19:23 forward declare CodecInst/VideoCodec and include w
magjed_webrtc 2016/11/23 16:35:52 Done.
25 // This strategy deals with the audio/video-specific aspects 25 // This strategy deals with the audio/video-specific aspects
26 // of payload handling. 26 // of payload handling.
27 class RTPPayloadStrategy { 27 class RTPPayloadStrategy {
28 public: 28 public:
29 virtual ~RTPPayloadStrategy() {} 29 virtual ~RTPPayloadStrategy() {}
30 30
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,
(...skipping 17 matching lines...) Expand all
52 protected: 52 protected:
53 RTPPayloadStrategy() {} 53 RTPPayloadStrategy() {}
54 }; 54 };
55 55
56 class RTPPayloadRegistry { 56 class RTPPayloadRegistry {
57 public: 57 public:
58 // The registry takes ownership of the strategy. 58 // The registry takes ownership of the strategy.
59 explicit RTPPayloadRegistry(RTPPayloadStrategy* rtp_payload_strategy); 59 explicit RTPPayloadRegistry(RTPPayloadStrategy* rtp_payload_strategy);
60 ~RTPPayloadRegistry(); 60 ~RTPPayloadRegistry();
61 61
62 int32_t RegisterReceivePayload(const char* payload_name, 62 // TODO(magjed): Split RTPPayloadRegistry into separate Audio and Video class
63 int8_t payload_type, 63 // and remove RTPPayloadStrategy, RTPPayloadVideoStrategy,
64 uint32_t frequency, 64 // RTPPayloadAudioStrategy, and simplify the code. http://crbug/webrtc/6743.
65 size_t channels, 65 int32_t RegisterReceivePayload(const CodecInst& audio_codec,
66 uint32_t rate, 66 bool* created_new_payload_type);
67 int32_t RegisterReceivePayload(const VideoCodec& video_codec,
67 bool* created_new_payload_type); 68 bool* created_new_payload_type);
68 69
69 int32_t DeRegisterReceivePayload(int8_t payload_type); 70 int32_t DeRegisterReceivePayload(int8_t payload_type);
70 71
71 int32_t ReceivePayloadType(const char* payload_name, 72 int32_t ReceivePayloadType(const CodecInst& audio_codec,
72 uint32_t frequency, 73 int8_t* payload_type) const;
73 size_t channels, 74 int32_t ReceivePayloadType(const VideoCodec& video_codec,
74 uint32_t rate,
75 int8_t* payload_type) const; 75 int8_t* payload_type) const;
76 76
77 bool RtxEnabled() const; 77 bool RtxEnabled() const;
78 78
79 void SetRtxSsrc(uint32_t ssrc); 79 void SetRtxSsrc(uint32_t ssrc);
80 80
81 bool GetRtxSsrc(uint32_t* ssrc) const; 81 bool GetRtxSsrc(uint32_t* ssrc) const;
82 82
83 void SetRtxPayloadType(int payload_type, int associated_payload_type); 83 void SetRtxPayloadType(int payload_type, int associated_payload_type);
84 84
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 134 }
135 135
136 int8_t last_received_media_payload_type() const { 136 int8_t last_received_media_payload_type() const {
137 rtc::CritScope cs(&crit_sect_); 137 rtc::CritScope cs(&crit_sect_);
138 return last_received_media_payload_type_; 138 return last_received_media_payload_type_;
139 } 139 }
140 140
141 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) {}
142 142
143 private: 143 private:
144 int32_t RegisterReceivePayload(const char* payload_name,
145 int8_t payload_type,
146 uint32_t frequency,
147 size_t channels,
148 uint32_t rate,
149 bool* created_new_payload_type);
150
151 int32_t ReceivePayloadType(const char* payload_name,
152 uint32_t frequency,
153 size_t channels,
154 uint32_t rate,
155 int8_t* payload_type) const;
156
144 // Prunes the payload type map of the specific payload type, if it exists. 157 // Prunes the payload type map of the specific payload type, if it exists.
145 void DeregisterAudioCodecOrRedTypeRegardlessOfPayloadType( 158 void DeregisterAudioCodecOrRedTypeRegardlessOfPayloadType(
146 const char* payload_name, 159 const char* payload_name,
147 size_t payload_name_length, 160 size_t payload_name_length,
148 uint32_t frequency, 161 uint32_t frequency,
149 size_t channels, 162 size_t channels,
150 uint32_t rate); 163 uint32_t rate);
151 164
152 bool IsRtxInternal(const RTPHeader& header) const; 165 bool IsRtxInternal(const RTPHeader& header) const;
153 166
(...skipping 10 matching lines...) Expand all
164 std::map<int, int> rtx_payload_type_map_; 177 std::map<int, int> rtx_payload_type_map_;
165 uint32_t ssrc_rtx_; 178 uint32_t ssrc_rtx_;
166 // Only warn once per payload type, if an RTX packet is received but 179 // Only warn once per payload type, if an RTX packet is received but
167 // no associated payload type found in |rtx_payload_type_map_|. 180 // no associated payload type found in |rtx_payload_type_map_|.
168 std::set<int> payload_types_with_suppressed_warnings_ GUARDED_BY(crit_sect_); 181 std::set<int> payload_types_with_suppressed_warnings_ GUARDED_BY(crit_sect_);
169 }; 182 };
170 183
171 } // namespace webrtc 184 } // namespace webrtc
172 185
173 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_PAYLOAD_REGISTRY_H_ 186 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_PAYLOAD_REGISTRY_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/include/rtp_receiver.h » ('j') | webrtc/modules/rtp_rtcp/include/rtp_receiver.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698