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

Unified Diff: webrtc/modules/rtp_rtcp/source/rtp_payload_registry.cc

Issue 2763323002: DCHECK that no RTPPayloadRegistry instance is used for both audio and video (Closed)
Patch Set: We ♥ locks! Created 3 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/source/rtp_payload_registry.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_payload_registry.cc b/webrtc/modules/rtp_rtcp/source/rtp_payload_registry.cc
index 3d2aad42a0160170b3e6be6cfe55dc05834bb213..1023bf8bb20ce05af91433c78decd931c3bcc55a 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_payload_registry.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_payload_registry.cc
@@ -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
« no previous file with comments | « webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698