On my another blog, I wrote about how to do live screencast on Linux with AVLD, FFmpeg, and mencoder. There was an unsolve problem, the performance of Flash Player. Actually, it also has problem with ustreamer.tv‘s broadcaster, the Flash object. It makes me get kerneloops. I seemed to solve it too, as well as the performance issue.

I have to clear that I don’t know much of C and not even to mention about kernel knowledge. Basically, you can say that I know nothing.

1   The kerneloops

I checked up the gspca’s code, I found out it uses copy_to_user instead of memcpy in read operation. That seems to solve the problem, though I really can’t say. At least, I haven’t seen oops again, so far.

2   Performance Issue

I thought Flash Player is the only one should take response of low FPS. But I realized that FFmpeg and mencoder actually can’t take care of 1280×960 at 4 FPS, they only use 12~15% CPU utilization, I don’t know why would they take more. Anyway, I downed the setting to 960×720 at 5 FPS. So far so good.

Now, back to Flash Player. I turned on debug switch in AVLD, then I found out Flash Player requests 1699 reads per second. But I only have 4 or 5 frames data. Isn’t that is too high? Same, I don’t know why would Flash Player request that many, but I do know that is the problem of performance. Flash Player must want to process all 1699 frames, though they are only in 5 different frames.

So what can I do? I just copy and paste a piece of code from v4l_write and paste that into v4l_read without any changes. Yep, exactly the same. My 2 cores use around 30%.

3   Patch

Here is a repack with modified video_device.c, and this is the bad patch.

I hope someone who knows entire thing can fix it correctly. I have mailed the author of AVLD few days ago when I just had problem, so far, I didn’t get any responses from the author.