Intermittent Audio Loss and Muffled Sound in GStreamer Pipeline Streaming G711ulaw RTP

Hi GStreamer Community,

I’m working on a pipeline that ingests audio data from a TCP port (sourced from Azure AI services) and streams it as “g711ulaw” RTP to a SIP endpoint. After overcoming an initial issue where the audio was entirely muffled (accidentally resolved by adding a tee element), I’m now facing intermittent audio loss (dropped words) in the stream. Here’s what I’ve verified so far:

Input Quality Confirmed:
The raw audio from Azure is saved to a WAV file, and playback confirms the source is clear and intact.

Issue Isolation Attempts:
Added a tee to split the pipeline: One branch writes to a file for debugging, the other sends RTP via udpsink. Both outputs exhibit the same audio loss, ruling out network issues. Infact I moved the tee element before "audioconvert’ and “audioresample” and it writes the output to file without any conversion with the same issues. Also adding the “audioconvert” makes no difference. “Audioremaple” is required as I had to downsample.

Replaced tcpclientsrc with filesrc to test TCP vs. file input. No difference observed, so the issue isn’t TCP-specific.

tee Element:
The tee “accidentally” resolved the earlier muffled audio issue. Removing it brings back the muffled sound.

As a GStreamer novice, I’m struggling to pinpoint why the tee fixes muffling and how to solve the audio loss issue.

Note: Comparing the WAV files written before and after GStreamer processing shows that almost half of the audio is lost, confirming significant audio loss through the pipeline.

pipeline config ( python ) ,


send_pipeline_description = (
            f"tcpclientsrc host={self.host} port={self.outbound_tcp_port} "
            "! rawaudioparse format=pcm pcm-format=s16le sample-rate=24000 num-channels=1 "
            "! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 leaky=downstream "
            #"! audioconvert "
            "! audioresample quality=4 ! capsfilter caps=audio/x-raw,rate=8000,channels=1 "
            

            
            # Split point
            "! tee name=t "
            
            # --- RTP Branch ---
            "t. ! queue max-size-time=0 "
            #"! audioconvert "
        
            "! capsfilter caps=audio/x-raw,format=S16LE,rate=8000,channels=1 "
            
            "! mulawenc "
            "! rtppcmupay pt=0 timestamp-offset=0 min-ptime=20000000 max-ptime=20000000 "
            
            # Critical network configuration
            f"! udpsink name=udpsink host={self.source_ip} port={self.source_port} "
            "ts-offset=0 sync=false async=false "
            "buffer-size=65535 "
            "auto-multicast=true "
            "qos-dscp=46 "  # Expedited Forwarding (VoIP priority)
            
             # --- WAV Branch ---
             "t. ! queue max-size-time=0 "
             "! wavenc ! filesink location=outbound.wav sync=true buffer-mode=2"
        )