Skip to content

Commit 136358a

Browse files
steveseguinclaude
andcommitted
fix(gstreamer): Remove video-specific rtcp-fb from audio section
GStreamer 1.18 incorrectly adds 'a=rtcp-fb:XX nack' and 'a=rtcp-fb:XX nack pli' to audio sections. These are video-specific feedback mechanisms for packet loss and keyframe requests that cause some WebRTC stacks to reject the audio description. Added fix_audio_rtcp_fb_for_gstreamer() to strip these inappropriate attributes from the audio section for GStreamer < 1.20. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent e350b95 commit 136358a

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

publish.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,32 @@ def strip_audio_from_sdp(sdp):
803803

804804
return '\r\n'.join(result_lines)
805805

806+
def fix_audio_rtcp_fb_for_gstreamer(sdp):
807+
"""Remove video-specific RTCP feedback attributes from audio section.
808+
809+
GStreamer 1.18 incorrectly adds 'a=rtcp-fb:XX nack' and 'a=rtcp-fb:XX nack pli'
810+
to audio sections. These are video-specific (for packet loss/keyframe requests)
811+
and cause some WebRTC stacks to reject the audio description.
812+
"""
813+
lines = sdp.split('\r\n')
814+
result_lines = []
815+
in_audio_section = False
816+
817+
for line in lines:
818+
if line.startswith('m=audio'):
819+
in_audio_section = True
820+
elif line.startswith('m=') and not line.startswith('m=audio'):
821+
in_audio_section = False
822+
823+
# Skip rtcp-fb nack lines in audio section (they're video-specific)
824+
if in_audio_section and line.startswith('a=rtcp-fb:'):
825+
if 'nack' in line.lower():
826+
continue # Skip nack and nack pli lines for audio
827+
828+
result_lines.append(line)
829+
830+
return '\r\n'.join(result_lines)
831+
806832
def generateHash(input_str, length=None):
807833
input_bytes = input_str.encode('utf-8')
808834
sha256_hash = hashlib.sha256(input_bytes).digest()
@@ -6911,6 +6937,8 @@ def on_offer_created(promise, _, __):
69116937
if 'm=audio' in text:
69126938
printc("Patching audio SDP for GStreamer 1.18 SSRC compatibility", "A6F")
69136939
text = fix_audio_ssrc_for_ohttp_gstreamer(text)
6940+
# Also remove video-specific rtcp-fb attributes from audio section
6941+
text = fix_audio_rtcp_fb_for_gstreamer(text)
69146942

69156943
# GStreamer 1.18 creates phantom audio section even with --noaudio
69166944
# Strip it from the SDP to avoid confusing Chrome

0 commit comments

Comments
 (0)