by MrLeap · 6y ago · 0 comments
The data isn't encoded in the usual ways, so even 4 hours of begging FFMPEG were to no avail.
A few glances at wireshark payloads, the roughly translated documentation, and weighing my options, I embarked on a harrowing journey to synthesize the correct incantation of bytes to get the device to give me what I needed.
I've never worked with RTP/RTSP prior to this -- and I was disheartened to see nodejs didn't have any nice libraries for them. Oh well, it's just udp when it comes down to it, right?
SO MY NAIVETE BEGOT A JOURNEY INTO THE DARKNESS. Being a bit of an unknown-unknown, this project did _not_ budget time for the effort this relatively impromptu initiative required. An element of sentimentality for the customer, and perhaps delusions of grandeur, I convinced myself I could just crunch it out in a few days.
A blur of coffee and 7 days straight crunch later, I built a daisy chain of crazy that achieved the goal I set out for. I read rfc3550 so many times I nearly have it committed to memory. The final task was to figure out how to forward the stream I had ensorcelled to another application. UDP seemed like the "right" choice, if I could preserve the heavy lifting I had accomplished to reassemble the frames of data.. MTU sizes are not big enough to accomodate this (hence probably why the device uses RTP, LOL.). OSX supports some hilariously massive MTU's (It's been a few days, but I want to say something like 13,000 bytes?) Still, I'd have to chunk and reasemble each frame into quarters. Having to write _additional_ client logic to handle drops and OOO and relying on OSX's embiggened MTU's when I wanted this to be relatively OS independent... and the SHIP OR DIE pressure from above made me do bad. At this point, I was so crunched out that the idea of writing reconnect logic and doing it with TCP was painful so I'm here to confess... I did bad...
The client application spawns a webserver, and the clients poll via HTTP at about 30HZ. Ahhh it's gross...
I'm basically adrift on a misery raft of my own manufacture. Maybe protobufs would be better? I've slept enough nights to take a melon baller to the bad parts..
The wiki page talks about getting 5% more data through at full saturation but it doesn’t mention an important detail that I recall from when it was proposed.
It turned out with gigabit Ethernet or higher that a single TCP connection cannot saturate the channel with an MTU of 1500 bytes. The bandwidth went up but the latency did not go down, and ACKs don’t arrive fast enough to keep the sender from getting throttled by the TCP windowing algorithm.
If I have a typical network with a bunch of machines on it nattering at each other, that might not sound so bad. But when I really just need to get one big file or stream from one machine to another, it becomes a problem.
So they settled on a multiple of 1500 bytes to avoid uneven packet fragmentation (if you get half packets every nth packet you lose that much throughput). Somehow that multiple became 6.
And then other people wanted bigger or smaller and I’m not quite sure how OS X ended up with 13000. You’re gonna get 8x1500 + 1000 there. Or worse, 9000 + 4000.
My very industrious teammate did 75% of the work (4 man team, I did 20%, if you are generous with the value of debugging). One of the things we/he tried was to just drop packets that arrived out of order rather than reorder them. Turned out the reordering logic was reducing framerates. So he ran some trials and looked at OOO traffic, and across the three or so routers between source and sink he never observed a single packet arriving out of order. So we just dropped them instead and got ourselves a few more frames per second.
I'm using a KoalaBarrel. Koalas receive envelopes full of eucalyptus leaves. Koalas have to eat their envelopes in order. First koala to get his full subscription becomes fat enough to crush all the koalas beneath him. Keep adding koalas. Disregard letters addressed to dead koalas.
For non-native speakers: embiggened means huge, enlarged, overgrown.
I am not a native speaker of English either
The word was created as a joke in a Simpsons episode, a word used in Springfield only. It is described as "perfectly cromulent" by a Springfielder, which is evidently meant to mean "acceptable" or "ordinary" but is another Springfieldism.
The joke may be lost on future generations who don't realise they're not normal words.
CONTEXTLESS, HEADERLESS, ENDLESS BYTE STREAMS OF COURSE, where the literal, idealized (remember udp) position of each byte is part of a vector in a non euclidean coordinate system.
I would love to read a collaborative work between you and James Mickens -- this genre of writing seems sadly under-present in the computing world...