

Route9.js: A VP8/WebM decoder in JavaScript - devongovett
http://badassjs.com/post/13551173773/route9-js-a-vp8-webm-decoder-in-javascript

======
tlrobinson
Neat, but it runs best on Chrome, which already has VP8/WebM.

I'm hoping eventually all the browsers will have something low level and fast
enough to realistically do this kind of thing (e.x. Native Client)

A lot of things that need native speeds can be run in sandboxes with a few IO
APIs (network, display, user input) just fine. Video codecs are a perfect
example.

Imagine being able to link your app to the best available version of HTML6
immediately... or some other application development environment entirely.

~~~
azakai
> I'm hoping eventually all the browsers will have something low level and
> fast enough to realistically do this kind of thing (e.x. Native Client)

I don't think Native Client is the solution. For technical reasons, the
sandboxing mechanism there has a big cost to entering and leaving the sandbox.
The worst case for that is something like a codec, where you constantly stream
information in and out. NaCl works better when you have lots of computation
and very little input/output.

(That might be fixable in theory, but just as fixable is the speed of
JavaScript.)

~~~
ryanpetrich
The cost is per transition and transferring a single native array per frame
should be cheap. There is no reason a NaCl decoder couldn't limit itself to
one write per frame and a single read when more data comes in.

~~~
azakai
One write per frame would potentially be not so bad, that's true. I wonder
though if you don't need to do some security measures there that could end up
as significant overhead (for example, JS engines have some anti-heapspray
techniques that do things to typed arrays - transferring large arrays between
the NaCl sandbox and the JS sandbox might want similar things). But maybe not.

Regardless, I think there are more suitable technologies for codecs on the
web: A lot can be done in WebGL shaders (Broadway is starting to work on
that), and proposed web standards like WebCL and RiverTrail look promising
too.

