str0m icon indicating copy to clipboard operation
str0m copied to clipboard

H265 support

Open showier-drastic opened this issue 7 months ago • 5 comments

These commits add full support for H265.

Including tests adapted from the pion/webrtc project. All tests passed. Also works on a test code that streams a local h265 bitstream.

However, the tests might not be thorough. It would be better to review the packetizer code to identify potential mismatch with the RFC.

showier-drastic avatar Jun 01 '25 08:06 showier-drastic

I would generate PCAP files from Safari and Chrome senders with h265 payloads and run them through the depacketizer.

I would encode a couple of payloads, then write a send recv integration tests that you tests both the packetizer and depacketizer.

xnorpx avatar Jun 01 '25 15:06 xnorpx

@showier-drastic thank you for looking at this!

I think removing the directives and fix any potential problems would be good.

algesten avatar Jun 01 '25 15:06 algesten

I would generate PCAP files from Safari and Chrome senders with h265 payloads and run them through the depacketizer.

I would encode a couple of payloads, then write a send recv integration tests that you tests both the packetizer and depacketizer.

This seems to be a bit big work for me. It seems that we don't have test suites like this available? I think I'm currently unable to writing these test suites. But if we have existing test suites, I'm more than happy to run and debug them.

Anyway, I successfully run it in on my local code to send stream from a local h265 file to the browser. I can tidy this code up and contribute this to the examples.

@showier-drastic thank you for looking at this!

I think removing the directives and fix any potential problems would be good.

Thanks, I will do this.

showier-drastic avatar Jun 01 '25 15:06 showier-drastic

This seems to be a bit big work for me. It seems that we don't have test suites like this available? I think I'm currently unable to writing these test suites. But if we have existing test suites, I'm more than happy to run and debug them.

We do have tests like that for the other protocols. Check out tests/data. I made the first of these pcaps using wireshark. Each protocol has *.pcap and a *.txt both are saved out from wireshark.

I believe we use SSLKEYLOGFILE with chrome, right @k0nserv?

algesten avatar Jun 02 '25 08:06 algesten

It's not SSLKEYLOGFILE for webrtc. Here's how I do it on macOS, but this can be tweaked for other operating systems

Chrome

Run chrome as $PATH_TO_CHROME --enable-logging -v=3 --force-fieldtrials=WebRTC-Debugging-RtpDump/Enabled/

Then use this script to turn it into a pcap

#!/bin/sh
function yes_or_no {
    while true; do
        read -p "$* [y/n]: " yn
        case $yn in
            [Yy]*) return 0  ;;  
            [Nn]*) return  1 ;;
        esac
    done
}
NOW=`date +"%Y-%m-%dT%H:%M"`

CHROME_LOG_PATH="${1:-$HOME/Library/Application Support/Google/Chrome Dev/chrome_debug.log}"
TEXT_2_PCAP="${2:-/Applications/Wireshark.app/Contents/MacOS/text2pcap}"
OUT_BASE_PATH="${3:-$HOME/Documents/chrome-rtp-dump}"
OUT_PATH="$OUT_BASE_PATH/rtp-dump-$NOW.pcap"

mkdir -p $OUT_BASE_PATH

grep RTP_DUMP "$CHROME_LOG_PATH" > "$OUT_BASE_PATH/rtp-dump-$NOW.log"
$TEXT_2_PCAP -D -u 5443,62132 -t %H:%M:%S.%f "$OUT_BASE_PATH/rtp-dump-$NOW.log" $OUT_PATH

echo "Open the pcap?"
yes_or_no && open $OUT_PATH

Firefox

Run using

#!/usr/bin/env sh
BINARY="/Applications/Firefox\ Developer\ Edition.app/Contents/MacOS/firefox"
export MOZ_LOG=timestamp,signaling:5,jsep:5,RtpLogger:5,SCTP:5
export MOZ_LOG_FILE=/tmp/moz_logs/log
export MOZ_DISABLE_CONTENT_SANDBOX=1
mkdir -p /tmp/moz_logs
echo "Starting $BINARY"
/Applications/Firefox\ Developer\ Edition.app/Contents/MacOS/firefox

Then convert to pcap with

#!/bin/sh
function yes_or_no {
    while true; do
        read -p "$* [y/n]: " yn
        case $yn in
            [Yy]*) return 0  ;;  
            [Nn]*) return  1 ;;
        esac
    done
}
NOW=`date +"%Y-%m-%dT%H-%M"`

LOG_PATH="${1:-/tmp/moz_logs/log.child-4.moz_log}"
TEXT_2_PCAP="${2:-/Applications/Wireshark.app/Contents/MacOS/text2pcap}"
OUT_BASE_PATH="${3:-$HOME/Documents/firefox-rtp-dump}"
OUT_PATH="$OUT_BASE_PATH/rtp-dump-$NOW.pcap"

mkdir -p $OUT_BASE_PATH

grep -o -E "(RTP_PACKET|RTCP_PACKET)(.*$)" $LOG_PATH | cut -d ' ' -f 2- > "$OUT_BASE_PATH/rtp-dump-$NOW.log"
$TEXT_2_PCAP -D -u 5443,62132 -t %H:%M:%S.%f "$OUT_BASE_PATH/rtp-dump-$NOW.log" $OUT_PATH

echo "Open the pcap?"
yes_or_no && open $OUT_PATH

k0nserv avatar Jun 02 '25 08:06 k0nserv