| 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> | 14 #include <map> |
| 15 #include <memory> | |
| 16 #include <set> | 15 #include <set> |
| 17 | 16 |
| 18 #include "webrtc/api/audio_codecs/audio_format.h" | 17 #include "webrtc/api/audio_codecs/audio_format.h" |
| 19 #include "webrtc/base/criticalsection.h" | 18 #include "webrtc/base/criticalsection.h" |
| 20 #include "webrtc/base/deprecation.h" | |
| 21 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h" | |
| 22 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 19 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
| 23 | 20 |
| 24 namespace webrtc { | 21 namespace webrtc { |
| 25 | 22 |
| 26 struct CodecInst; | 23 struct CodecInst; |
| 27 class VideoCodec; | 24 class VideoCodec; |
| 28 | 25 |
| 29 // TODO(magjed): Remove once external code is updated. | |
| 30 class RTPPayloadStrategy { | |
| 31 public: | |
| 32 static RTPPayloadStrategy* CreateStrategy(bool handling_audio) { | |
| 33 return nullptr; | |
| 34 } | |
| 35 }; | |
| 36 | |
| 37 class RTPPayloadRegistry { | 26 class RTPPayloadRegistry { |
| 38 public: | 27 public: |
| 39 RTPPayloadRegistry(); | 28 RTPPayloadRegistry(); |
| 40 ~RTPPayloadRegistry(); | 29 ~RTPPayloadRegistry(); |
| 41 // TODO(magjed): Remove once external code is updated. | |
| 42 explicit RTPPayloadRegistry(RTPPayloadStrategy* rtp_payload_strategy) | |
| 43 : RTPPayloadRegistry() {} | |
| 44 | 30 |
| 45 // TODO(magjed): Split RTPPayloadRegistry into separate Audio and Video class | 31 // TODO(magjed): Split RTPPayloadRegistry into separate Audio and Video class |
| 46 // and simplify the code. http://crbug/webrtc/6743. | 32 // and simplify the code. http://crbug/webrtc/6743. |
| 47 | 33 |
| 48 // Replace all audio receive payload types with the given map. | 34 // Replace all audio receive payload types with the given map. |
| 49 void SetAudioReceivePayloads(std::map<int, SdpAudioFormat> codecs); | 35 void SetAudioReceivePayloads(std::map<int, SdpAudioFormat> codecs); |
| 50 | 36 |
| 51 int32_t RegisterReceivePayload(const CodecInst& audio_codec, | 37 int32_t RegisterReceivePayload(const CodecInst& audio_codec, |
| 52 bool* created_new_payload_type); | 38 bool* created_new_payload_type); |
| 53 int32_t RegisterReceivePayload(const VideoCodec& video_codec); | 39 int32_t RegisterReceivePayload(const VideoCodec& video_codec); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 void set_last_received_payload_type(int8_t last_received_payload_type) { | 98 void set_last_received_payload_type(int8_t last_received_payload_type) { |
| 113 rtc::CritScope cs(&crit_sect_); | 99 rtc::CritScope cs(&crit_sect_); |
| 114 last_received_payload_type_ = last_received_payload_type; | 100 last_received_payload_type_ = last_received_payload_type; |
| 115 } | 101 } |
| 116 | 102 |
| 117 int8_t last_received_media_payload_type() const { | 103 int8_t last_received_media_payload_type() const { |
| 118 rtc::CritScope cs(&crit_sect_); | 104 rtc::CritScope cs(&crit_sect_); |
| 119 return last_received_media_payload_type_; | 105 return last_received_media_payload_type_; |
| 120 } | 106 } |
| 121 | 107 |
| 122 RTC_DEPRECATED void set_use_rtx_payload_mapping_on_restore(bool val) {} | |
| 123 | |
| 124 private: | 108 private: |
| 125 // Prunes the payload type map of the specific payload type, if it exists. | 109 // Prunes the payload type map of the specific payload type, if it exists. |
| 126 void DeregisterAudioCodecOrRedTypeRegardlessOfPayloadType( | 110 void DeregisterAudioCodecOrRedTypeRegardlessOfPayloadType( |
| 127 const CodecInst& audio_codec); | 111 const CodecInst& audio_codec); |
| 128 | 112 |
| 129 bool IsRtxInternal(const RTPHeader& header) const; | 113 bool IsRtxInternal(const RTPHeader& header) const; |
| 130 // Returns the payload type for the payload with name |payload_name|, or -1 if | 114 // Returns the payload type for the payload with name |payload_name|, or -1 if |
| 131 // no such payload is registered. | 115 // no such payload is registered. |
| 132 int8_t GetPayloadTypeWithName(const char* payload_name) const; | 116 int8_t GetPayloadTypeWithName(const char* payload_name) const; |
| 133 | 117 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 148 // video, DCHECK that no instance is used for both audio and video. | 132 // video, DCHECK that no instance is used for both audio and video. |
| 149 #if RTC_DCHECK_IS_ON | 133 #if RTC_DCHECK_IS_ON |
| 150 bool used_for_audio_ GUARDED_BY(crit_sect_) = false; | 134 bool used_for_audio_ GUARDED_BY(crit_sect_) = false; |
| 151 bool used_for_video_ GUARDED_BY(crit_sect_) = false; | 135 bool used_for_video_ GUARDED_BY(crit_sect_) = false; |
| 152 #endif | 136 #endif |
| 153 }; | 137 }; |
| 154 | 138 |
| 155 } // namespace webrtc | 139 } // namespace webrtc |
| 156 | 140 |
| 157 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_PAYLOAD_REGISTRY_H_ | 141 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_PAYLOAD_REGISTRY_H_ |
| OLD | NEW |