DCHECK that no RTPPayloadRegistry instance is used for both audio and video
BUG=webrtc:5805 Review-Url: https://codereview.webrtc.org/2763323002 Cr-Commit-Position: refs/heads/master@{#17352}
This commit is contained in:
parent
65cb53a5c6
commit
b0bf93a4b7
@ -138,6 +138,13 @@ class RTPPayloadRegistry {
|
||||
// Only warn once per payload type, if an RTX packet is received but
|
||||
// no associated payload type found in |rtx_payload_type_map_|.
|
||||
std::set<int> payload_types_with_suppressed_warnings_ GUARDED_BY(crit_sect_);
|
||||
|
||||
// As a first step in splitting this class up in separate cases for audio and
|
||||
// video, DCHECK that no instance is used for both audio and video.
|
||||
#if RTC_DCHECK_IS_ON
|
||||
bool used_for_audio_ GUARDED_BY(crit_sect_) = false;
|
||||
bool used_for_video_ GUARDED_BY(crit_sect_) = false;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -121,12 +121,17 @@ RTPPayloadRegistry::~RTPPayloadRegistry() = default;
|
||||
|
||||
int32_t RTPPayloadRegistry::RegisterReceivePayload(const CodecInst& audio_codec,
|
||||
bool* created_new_payload) {
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
|
||||
#if RTC_DCHECK_IS_ON
|
||||
RTC_DCHECK(!used_for_video_);
|
||||
used_for_audio_ = true;
|
||||
#endif
|
||||
|
||||
*created_new_payload = false;
|
||||
if (!IsPayloadTypeValid(audio_codec.pltype))
|
||||
return -1;
|
||||
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
|
||||
auto it = payload_type_map_.find(audio_codec.pltype);
|
||||
if (it != payload_type_map_.end()) {
|
||||
// We already use this payload type. Check if it's the same as we already
|
||||
@ -154,11 +159,16 @@ int32_t RTPPayloadRegistry::RegisterReceivePayload(const CodecInst& audio_codec,
|
||||
|
||||
int32_t RTPPayloadRegistry::RegisterReceivePayload(
|
||||
const VideoCodec& video_codec) {
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
|
||||
#if RTC_DCHECK_IS_ON
|
||||
RTC_DCHECK(!used_for_audio_);
|
||||
used_for_video_ = true;
|
||||
#endif
|
||||
|
||||
if (!IsPayloadTypeValid(video_codec.plType))
|
||||
return -1;
|
||||
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
|
||||
auto it = payload_type_map_.find(video_codec.plType);
|
||||
if (it != payload_type_map_.end()) {
|
||||
// We already use this payload type. Check if it's the same as we already
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user