Browser git · main
Minimal browser in C (mini and big variant)
C 95.6% Markdown 4.2%git clone https://git.christianimmanuel.de/web-tools/Browser.gitwget https://git.christianimmanuel.de/web-tools/Browser/archive/Browser.tar.gzDebugging gif gst glitches AND better useragent handling
Makefile | 2 +- README.md | 4 ++-- browser-big.c | 18 ++++++++++++++---- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 9cec0b6..ab8d52b 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ CC ?= gcc CFLAGS ?= -O2 -Wall -Wextra -rdynamic PREFIX ?= /usr -VERSION := 4.42.0 +VERSION := 4.43.0 SOURCES := browser_core.c browser_core.h browser-mini.c browser-big.c Makefile BUILD_ID := $(shell cat $(SOURCES) 2>/dev/null | md5sum | cut -c1-7) diff --git a/README.md b/README.md index 020a54f..52a9fe9 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ make # build both make install # into /usr/bin (PREFIX=... to change) make uninstall make clean -make version # 4.42.0 (build …), md5 of the sources +make version # 4.43.0 (build …), md5 of the sources ``` ## Usage @@ -178,7 +178,7 @@ browser-big URL --rtc-trace 2>&1 | tee /tmp/bb.log | `sdp` | Each description, codecs as `payload-type name` | | `ssrc-real`, `ssrc-ws`, `pt-fixed` | The server got the real SSRC and payload type | | `rtc-stats` | Every 3 s: `out-*` sent, `far-*` server report, `in-*` received | -| `video-state` | Each `<video>`: size, `frames` shown, `dframes` since last tick | +| `video-state` | Every `<video>` with a source, camera or file: size, `ct`/`dur`, `loop`, `seeking`, `frames` shown, `dframes` and `ddropped` since last tick | | `stuck: true` | On `rtc-stats` or `video-state`: counters stopped moving | | `video-audio-split` | A silent-audio stream shown video-only | | `codec-mismatch` | We encode something the far end did not agree to | diff --git a/browser-big.c b/browser-big.c index 6887d40..1daee51 100644 --- a/browser-big.c +++ b/browser-big.c @@ -779,14 +779,23 @@ static const char *SHIM_JS = " setInterval(function(){" " var l=document.querySelectorAll('video');" " for(var i=0;i<l.length;i++){var v=l[i];" -" if(!v.srcObject)continue;" +/* + * Any element with a source, not just a camera: a page of muted autoplay + * videos is where frames actually go missing, and those carry src, not + * srcObject. dur and the two decimals on ct place a glitch against the + * loop point, which a whole-second ct could not. + */ +" if(!v.srcObject&&!v.currentSrc&&!v.src)continue;" " if(vids.indexOf(v)<0)vids.push(v);" " var q=null;try{q=v.getVideoPlaybackQuality?v.getVideoPlaybackQuality():null;}catch(e){}" " var r=v.getBoundingClientRect(),st=getComputedStyle(v),vt=[];" -" try{vt=v.srcObject.getVideoTracks();}catch(e){}" +" try{vt=v.srcObject?v.srcObject.getVideoTracks():[];}catch(e){}" " var o={ev:'video-state',v:vids.indexOf(v),id:v.id||v.className||''," " ready:v.readyState,paused:v.paused,w:v.videoWidth,h:v.videoHeight," -" ct:Math.round(v.currentTime||0),frames:q?q.totalVideoFrames:-1," +" ct:Math.round((v.currentTime||0)*100)/100," +" dur:Math.round((v.duration||0)*100)/100," +" loop:!!v.loop,seeking:!!v.seeking," +" frames:q?q.totalVideoFrames:-1," " dropped:q?q.droppedVideoFrames:-1," " box:Math.round(r.width)+'x'+Math.round(r.height)," " shown:st.display!=='none'&&st.visibility!=='hidden'&&+st.opacity>0," @@ -802,9 +811,10 @@ static const char *SHIM_JS = */ " var k=JSON.stringify(o),p=vlast.get(v)||{};" " o.dframes=(o.frames>=0&&p.frames>=0)?o.frames-p.frames:-1;" +" o.ddropped=(o.dropped>=0&&p.dropped>=0)?o.dropped-p.dropped:-1;" " o.stuck=(o.dframes===0&&o.ready>=2&&!o.paused);" " var rep=(k!==p.k)||(!!o.stuck!==!!p.stuck);" -" vlast.set(v,{k:k,frames:o.frames,stuck:o.stuck});" +" vlast.set(v,{k:k,frames:o.frames,dropped:o.dropped,stuck:o.stuck});" " if(rep)post(o);" " }" " },3000);"