Skip to content

Instantly share code, notes, and snippets.

View mqp's full-sized avatar

Marshall Polaris mqp

  • Mountain View, CA
View GitHub Profile
@mqp
mqp / express-basic.js
Created February 6, 2020 05:28
Simple Express error handling
const app = require('express')();
const fs = require('fs');
// Resolves with a list of the filenames in dir, or rejects if dir doesn't exist or if something else goes wrong.
function readFileNames(dir) {
return new Promise((resolve, reject) => {
fs.readdir(dir, (err, files) => {
if (err) {
reject(err);
} else {
@mqp
mqp / express-wrapper.js
Created February 6, 2020 05:27
Fancy Express error handling
const app = require('express')();
const fs = require('fs');
// Resolves with a list of the filenames in dir, or rejects if dir doesn't exist or if something else goes wrong.
function readFileNames(dir) {
  return new Promise((resolve, reject) => {
    fs.readdir(dir, (err, files) => {
      if (err) {
        reject(err);
      } else {
@mqp
mqp / janus-udp-failure.log
Created July 3, 2018 21:18
Janus failing to complete ICE over UDP on Nightly
Janus commit: 3c5ad1b125f696a32c85420f31a24eec79b35028
Compiled on: Tue Jul 3 14:07:51 PDT 2018
---------------------------------------------------
Starting Meetecho Janus (WebRTC Gateway) v0.4.3
---------------------------------------------------
Checking command line arguments...
[janus.cfg]
[general]
@mqp
mqp / plans.md
Created December 20, 2017 00:20
Social MR planning

Here are some different things that seem potentially valuable which we could consider to produce next year, roughly ordered by how useful I think they would be, with the most useful at the top. It's possible I forgot some things.

WebXR client infrastructure work

Right now, I observe that not many people are making any XR thing on the web. Part of it might be that WebXR is new, but part is that it's relatively bad. Naively, my guess is that three.js and A-Frame tooling and performance (and WebXR browser features) is where most of the gap is, and making them more competitive with Unreal or Unity would be attacking that problem. Something like the Unity editor, for example, would go a long way. Improving networked-aframe could be useful. Adding browser features to make the experience of using WebXR smoother could be useful. I defer to

@mqp
mqp / gist:7c935aad1a831bff21d9e1ae7c92e7c0
Created December 7, 2017 00:20
Valgrind output for ICE handle free race
==19910== Thread 8:
==19910== Invalid read of size 4
==19910== at 0x6B581A4: pthread_mutex_lock (pthread_mutex_lock.c:81)
==19910== by 0x16EFE6: janus_plugin_handle_sdp (janus.c:2818)
==19910== by 0x16C5AC: janus_plugin_push_event (janus.c:2657)
==19910== by 0x14467F4C: janus_plugin_sfu::push_response (in /opt/janus/lib/janus/plugins/libjanus_plugin_sfu.so)
==19910== by 0x1446BB09: janus_plugin_sfu::handle_message_async (in /opt/janus/lib/janus/plugins/libjanus_plugin_sfu.so)
==19910== by 0x1444EA23: std::sys_common::backtrace::__rust_begin_short_backtrace (in /opt/janus/lib/janus/plugins/libjanus_plugin_sfu.so)
==19910== by 0x1444FD22: std::panicking::try::do_call (in /opt/janus/lib/janus/plugins/libjanus_plugin_sfu.so)
==19910== by 0x1449DB1C: __rust_maybe_catch_panic (lib.rs:99)
@mqp
mqp / gist:72776ae34824059a4818bc160bd36fc5
Created December 6, 2017 22:43
ASan output for Janus ICE destruction incoming data race
#0 0x5575b8946289 in janus_dtls_notify_data /home/mquander/src/janus-gateway/dtls.c:924
#1 0x5575b8a3b025 in janus_sctp_handle_data_message /home/mquander/src/janus-gateway/sctp.c:939
#2 0x5575b8a3b34c in janus_sctp_handle_message /home/mquander/src/janus-gateway/sctp.c:989
#3 0x5575b8a2ef1c in janus_sctp_incoming_data /home/mquander/src/janus-gateway/sctp.c:343
#4 0x7f010e0f4b4a in sctp_invoke_recv_callback netinet/sctputil.c:4855
#5 0x7f010e0f5236 in sctp_add_to_readq netinet/sctputil.c:4963
#6 0x7f010e079940 in sctp_process_a_data_chunk netinet/sctp_indata.c:2103
#7 0x7f010e07ba31 in sctp_process_data netinet/sctp_indata.c:2760
#8 0x7f010e095b9e in sctp_common_input_processing netinet/sctp_input.c:6162
#9 0x7f010e060d2b in usrsctp_conninput /home/mquander/src/janus-plugin-sfu/build/sctplab/usrsctp/usrsctplib/user_socket.c:3375
@mqp
mqp / gist:149f0ba645801913e0cfd55ac6303144
Last active December 6, 2017 22:42
ASan output for Janus ICE destruction shutdown alert race
==24300==ERROR: AddressSanitizer: heap-use-after-free on address 0x612000859908 at pc 0x5639a5226111 bp 0x7fdea5b5e200 sp 0x7fdea5b5e1f0
READ of size 8 at 0x612000859908 thread T1937 (icesend 2661940)
#0 0x5639a5226110 in janus_ice_send_thread /home/mquander/src/janus-gateway/ice.c:3360
#1 0x7fdf95d21644 (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x72644)
#2 0x7fdf945347fb in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x77fb)
#3 0x7fdf94261b0e in clone (/lib/x86_64-linux-gnu/libc.so.6+0x114b0e)
0x612000859908 is located 200 bytes inside of 280-byte region [0x612000859840,0x612000859958)
freed by thread T1918 (iceloop 2661940) here:
#0 0x7fdf9653c7b8 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde7b8)
@mqp
mqp / gist:b8d021336b8d9057692e6d70da80a79e
Created November 18, 2017 02:29
janus-refcount-early-destruction
Janus commit: abe0d16b54517c4331002de9e0c7a1b270ef8f80
Compiled on: Fri Nov 17 16:36:45 PST 2017
---------------------------------------------------
Starting Meetecho Janus (WebRTC Gateway) v0.2.6
---------------------------------------------------
Checking command line arguments...
[janus.cfg]
[general]
@mqp
mqp / janus-refcount-no-sdp-leak
Created November 18, 2017 00:23
janus-refcount-no-sdp-leak
Janus commit: f4fd0084393c1c892b314bb728b7367504df7237
Compiled on: Fri Nov 17 16:22:04 PST 2017
---------------------------------------------------
Starting Meetecho Janus (WebRTC Gateway) v0.2.6
---------------------------------------------------
Checking command line arguments...
[janus.cfg]
[general]
@mqp
mqp / test.html
Created November 15, 2017 22:09
Test page for Firefox media stream code
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tiny test page</title>
</head>
<body>
<form id="form">
<input id="file" type="file" />
<input type="submit" val="Load"/>