Friday, 2 April 2010

New Ogg video decoder for Firefox

Today I finally landed the new Ogg video decoder for Firefox/Mozilla. It should appear in Firefox nightlies from 2 April 2010 onwards. Chris Double did the initial implementation for the new Ogg decoder, and I took over in December, implemented seeking, and bashed it into shape.

This replaces our old Ogg decoder which used liboggplay. We'll now be able to implement new features easier, and have greater control over our decode pipeline. We can now control our audio and video decode separately, and this allows us to do things like not decoding video interframes if the video decode is taking too much time and causing the audio decode to fall behind. This prevents audio stutter when decoding large-frame-sized videos. The new backend also has more reliable seeking, and can even load a few weirdly formed Ogg files that the previous backend couldn't handle.

It was a large patch, and it's a testament to our robust set of video and audio unit tests that when I checked it into mozilla-central, there was basically only one small fix required. It has been a long grind getting the new decoder to work robustly, but our unit tests have been an invaluable, if fickle, task-mistress.

The new backend should at least be feature-equivalent to the old backend. If you spot a regression in Ogg video playback in new nightly builds, please file a bug in Core in the "Video/Audio" component!


supernova_00 said...

watching the big buck bunny ogg video today and the sound doesn't skip anymore. Video still stutters though but it looks like bug 531340 helped a lot!

Great job!

Dorus said...

Not sure i used the right nightly (Gecko/20100402) but when i compare this nighly, a old nightly from January and Vlc media player, i notice vlc needs 5x less CPU then Firefox. The 2 nightly's i compare used equal CPU.

Will firefox get closer to this performance in the future? And what is the reason for a big difference like this?

Chris Pearce said...

@Dorus: The reason Firefox uses more CPU when playing video than other stand alone media players is that Firefox doesn't (yet) use hardware acceleration to do its rendering. This is because we need to run the video through our HTML rendering pipeline which currently isn't accelerated. Stand alone players like VLC don't have to worry about that, and can use hardware acceleration, and so will use less CPU. We're working on getting hardware acceleration into Firefox.

antistress said...

regarding these improvements in Ogg Theora support, what is the situation in Firefox WebM builds ? Will they needs the same kind of improvements or are they already implemented ?

Chris Pearce said...

@antistress: The new WebM decoder shares much of the new Ogg decoder's playback logic. This means we don't need to implement all the HTML5 compliance logic twice, saving us a lot of work.