Thursday, July 05, 2007

Patch for Video element support in Firefox

I've uploaded a patch which is the first pass at implementing support for the <video> element in Firefox. The patch is attached to bug 382267.

There are quite a few known issues with the patch at the moment, and I'm working through them, but I've made it available at this time so others can at least try it out. A page with some example usage is here: http://www.double.co.nz/video_test.

To build you'll need the latest Firefox CVS, and apply the following:I've also made a git repository available that tracks my work on video. This is basically Firefox CVS with the patch applied, and is the repository I used to generate the patch in the first place. I'll be updating that regularly with my changes between patch generation for the bugzilla entry. You can track this repository with one of the following commands:
git clone http://double.co.nz/git/video.git
git clone git://double.co.nz/git/video.git
The main issues at the moment are problems with optimized builds, so I suggest trying it out with a debug build. I'm also not using channels correctly for multithreaded code which is the cause for a bit of instability. Read the bug for further details.

Categories: ,

Labels:

17 Comments:

Blogger Roberto said...

Do you have a recent build for the intel mac laying around ? (In case not, I started already to clone your git repo)

5:19 PM  
Blogger Chris Double said...

I do but I've just left for home, and fly to Wellington tonight. I can upload it then (about 5 hours from now). I'll also upload a windows build.

5:46 PM  
Anonymous Wolfgang said...

Why do you use portaudio?
That's a bad solution on Linux at the moment AFAIK since its ALSA supports is not really complete yet.

6:08 PM  
Blogger Chris Double said...

There was a thread on mozilla.dev.platform about audio library choice. I think it's also discussed under the bug for the audio element.

Basically it came down to openal or portaudio, and the latter had a more compatible license.

I'm open to suggestions for alternatives though if you know of something more suitable.

6:48 PM  
Blogger ginger said...

Are you using liboggplay as a library? http://svn.annodex.net/liboggplay/trunk/README

10:56 PM  
Blogger Chris Double said...

ginger, I use liboggplay in the implementation, yes. It's a great library. Much easier to use than the vorbis and theora API's directly.

11:07 PM  
Blogger maikmerten said...

Cool stuff. Once a build shows up I'll have a lot of fun toying around with it, that's for sure.

12:10 AM  
Blogger Chris Double said...

I've added a download for a Mac OS X Intel build.

3:56 PM  
Blogger Roberto said...

played with the build. great !!

I hope you will bring down CPU usage so it works on slow machines.

I also hope you will implement seek (if possible at all) based on HTTP content range. In flash video, this is only possible with a lot of serverside trickery.

And again, this is great, I hope it goes into FF3.

10:18 PM  
Blogger maikmerten said...

Well, the Theora decoder used seems to stem from one of the official Theora alpha releases, which features a rather slow and incomplete decoder. Current Theora SVN has a decoder that is a) implementing the complete spec and b) is faster on high resolution content.

We really should put up a new release with the new decoder included.

10:40 PM  
Blogger Chris Double said...

roberto, glad it worked for you! I've done no work yet on optimisation so things will improve on the CPU usage I'm sure.

Also, as maikmerten mentioned, I'm using the alpha source release of theora. It has no optimised assembly implementation for Mac OS X. It sound s like the SVN version is much improved.

maikmerten, I'd love a new source release! I was going to work off SVN but there was some concern from one of the oggplay people in that they weren't sure it worked on some platforms with their code. I'm keen to try the newer codebase though.

10:58 PM  
Blogger Chris Double said...

roberto, oops, missed the seek question. Yes, I plan to add seek support. liboggplay supports seeking as long as the implementations of their 'reader' abstraction implements some functions.

I'm not using their tcp reader implementation, instead implementing a reader for Mozilla's networking API's so I need to do a bit of work there but it's on the list of things to do.

11:12 PM  
Anonymous schuyler said...

I'm trying to compile for Linux off of your git repo, and I'm getting stuck on the build with undefined references in
mozilla/content/media/modules/portaudio/src/hostapi/alsa/pa_linux_alsa.c
for example for snd_pcm_info() snd_pcm_info_get_card(). How do I include the alsa or other libs for a successful make?

3:16 AM  
Blogger Chris Double said...

If you are doing a libxul enabled build (which is the default), there was an issue where I was missing libraries. I pushed a patch to the git repository last night which fixed that.

Otherwise, a workaround is to put the following in your .mozconfig:

ac_add_options --disable-libxul

Let me know if either of these two suggestions work.

9:42 AM  
Anonymous schuyler said...

Pulling your update on git worked fine.

All of the tests work except for the first (test1,play1) which reports in the shell repeatedly:
"Buffer is larger than read request: request: 8192 buffer: 291808"
and clicking 'Pause 1' it freezes firefox.

test2.html doesn't seem to open. However, after removing the '<video>' text from the title, and opening it locally, it worked fine.

I didn't express before how important this work is. Many many thanks from those that work extensively with video on the web, and would like more open options than, e.g. flash.

Please keep us updated on how we can help testing, etc.

8:27 AM  
Blogger Chris Double said...

Thanks schuyler. What platform did you run it on?

I've pushed an update yesterday that changes the way I was doing buffering and using channels. In my tests it now is more stable so hopefully you should be able to run the tests that didn't work before.

1:27 PM  
Anonymous schuyler said...

The main machine i'm testing is Linux x86_64 (Mac Pro hardware).
Test1.1 plays now, but plays very slowly (actually, they all do). Pausing Test1.1 still crashes firefox. This is the output from playing test1.1 and then clicking pause:

--------------------
Got vorbis info: version 0 channels 2 rate 44100
There are 2 tracks
Frame rate: 29.970030
samplerate: 44100, channels: 2
About to start decoding...
Starting decoding
###!!! ASSERTION: nsGenericElement not thread-safe: '_mOwningThread.GetThread() == PR_GetCurrentThread()', file /home/sky/sb/firefox/video/mozilla/content/base/src/nsGenericElement.cpp, line 3376
Frame Needs Reflow!
nsHTMLVideoFrame::ComputeSize
ChannelToPipeListener::OnStopRequest
WARNING: Write failed (non-fatal): file /home/sky/sb/firefox/video/mozilla/xpcom/io/nsInputStreamTee.cpp, line 84
Presentation thread completed
Decoding loop completed.
------------------

Here's my build for x86_64.

4:27 AM  

Post a Comment

<< Home