diff --git a/pc/channel.cc b/pc/channel.cc index 9e113c819f..b85122d922 100644 --- a/pc/channel.cc +++ b/pc/channel.cc @@ -133,7 +133,16 @@ BaseChannel::BaseChannel(rtc::Thread* worker_thread, ssrc_generator_(ssrc_generator) { RTC_DCHECK_RUN_ON(worker_thread_); RTC_DCHECK(ssrc_generator_); - demuxer_criteria_.mid = content_name; + // Temp fix: MID in SDP is allowed to be slightly longer than what's allowed + // in the RTP demuxer. Truncate if needed; this won't match, but it only + // makes sense in places that wouldn't use this for matching anyway. + // TODO(bugs.webrtc.org/12517): remove when length 16 is policed by parser. + if (content_name.size() > 16) { + RTC_LOG(LS_ERROR) << "Overlong mid attribute, truncating for matching"; + demuxer_criteria_.mid = content_name.substr(0, 16); + } else { + demuxer_criteria_.mid = content_name; + } RTC_LOG(LS_INFO) << "Created channel: " << ToString(); }