Monthly Archives: March 2012

OSD700 – 0.8 Release

For this release, and the remaining of the semester, I have and will be working on implementing the missing video statistics with my colleague Dave Seifried. For starters I have been attacking the playbackJitter statistic and let me tell you, for someone who has never worked with this area of the code before it has been quite challenging figuring out how things work on this side of things. Perhaps I shouldn’t have jumped over to this stuff this late in the semester but then again it’s been quite the change of pace.

To be brief, playbackJitter is used to obtain an overall metric for perceived playback quality and smoothness of the video up to the current point when the value was been retrieved. From what I gather, it’s something that is constantly calculated along the way so where I wind up placing the code to calculate this is going to be key.

By now I know how to easily update the IDL files and add getters/setters for the attributes (getter only in this case). The problem becomes figuring out where the information I need to manipulate is and appropriately giving myself a path to access that information. At this point I’m relatively comfortable with speaking with some of these immensely smart people who work with Mozilla so I went about talking to Chris Pearce about the kinds of things I should be looking at for this.

He first pointed me in the direction of looking at how MozFrameDelay was handled in the nsDOMHTMLVideoElement.cpp class. In this case the information is handled in VideoImageContainer::SetCurrentFrame() by setting the mPaintDelay member variable here each time SetCurrentFrame() is called and then grabbing it’s value in seconds. In the end a VideoFrame is just an image so it actually makes sense in the end. VideoImageContainer::SetCurrentFrame() itself is actually set everytime a current frame is true (in this case I’m assuming it means that were was a frame successfully decoded) in nsBuiltinDecoderStateMachine::AdvanceFrame() which calls nsBuiltinDecoderStateMachine::RenderVideoFrame().

So I can see how that all links together right now which makes a lot of sense to me.

This then has lead me to look at all the different bits of data available to me within VideoImageContainer. FrameDelay I feel definitely is part of it, but I at this point I don’t think with the code that is available there that I could actually calculate playbackJitter. This leads me to a suggestion cpearce gave to me that I should add a new parameter to SetCurrentFrame that will contain the data about the actual intended time the frame spent on the screen. This data could be easily grabbed from the aData argument of nsBuiltinDecoderStateMachine::RenderVideoFrame().

I now have a good direction to aim for and have a concrete idea of what I actually need to do. Stay tuned for tomorrow as I’ll actually be able to implement something!

WWWYKI

Implementing Video Playback Statistics in Firefox – Part I

So for my final push this semester I, along with Dave Seifried, will be implementing some of the missing video statistics for Firefox. Not only is this something that is sort of the culmination of every little bit that I have learned in this process but it’s something I will be able to put my name to forever, something tangible that I can say I have done and the average person (Okay who am I kidding, the average developer) will be able to see on the surface and use.

For starters I am looking at implementing playbackJitter, based on the spec seen here. According to the spec it is something that only pertains to video elements so instead of declaring my attribute in nsIDOMHTMLMediaElement.idl I will go with nsIDOMHTMLVideoElement.idl as that just makes more sense in my mind.

Playback jitter, at least from what I understand, is basically the desired amount of time spent on screen for a frame minus the actual amount of time spent on screen. I’m guessing it should be for all frames but that’s something I’m going to have to question a bit over in #media.

At this point I don’t know what type it should be. For now I’ve gone with a double because at this point I only have a basic getter working. I imagine I’ll figure this out once I take a look around some of the classes VideoElement inherits from as I’m guessing it already has some of the information I am looking for, along with plenty of stuff in good old nsBuiltinDecoder.

That’s it for now. Going to be diving into this over the next few days!

OSD700 – Release 0.7

Delayed and short. I’m disappointed in myself with this one but at the same time I’m excited for what I have planned for the rest of this semester.

I’ve progressed more with Bug 720768. I’ve bounced around a lot with this one because for a while I wasn’t sure how I would deal with how SmsManager handled this DispatchToSelf method different than the others because it attached a message to the event.

I’ve since talked with Mounir and he has given me suggestions on how I should approach this. Instead of using the message I’m going to have the method accepted an nsIDOMEvent pointer that will default to nsnull if not given. If this argument is nsnull then I will know that it isn’t coming from SmsManager and can construct the event myself. If it isn’t nsnull then I will know the call was coming from SmsManager and I can act accordingly.


// static
nsresult
nsContentUtils::DispatchToSelf(const nsAString& aEventName, nsIDOMEvent* aEvent)
{
nsresult rv;
nsRefPtr event;
if (!aEvent) {
event = new nsDOMEvent(nsnull, nsnull);
rv = event->InitEvent(aEventName, false, false);
NS_ENSURE_SUCCESS(rv, rv);
}

rv = event->SetTrusted(true);
NS_ENSURE_SUCCESS(rv, rv);

bool dummy;
rv = nsDOMEventTargetHelper::DispatchEvent(event, &dummy);
NS_ENSURE_SUCCESS(rv, rv);

return NS_OK;
}

That is the code thusfar for it. At this point I don’t know how I can go about converting the aEvent nsIDOMEvent pointer to a plain old nsDOMEvent. I can’t have the method accept an nsDOMEvent pointer instead either so I’m not sure where to go here. My attempts at various casts haven’t worked thusfar.

On top of all that I’m still trying to figure out the best way to use DispatchEvent in nsDOMEventTargetHelper. I have had the suggestion given to me to use nsIDOMEventTarget but I haven’t found a way to properly initialize it. Time to sprechen to the good folks in #introduction/#developers some more!

What has me most excited is the fact that by the end of this semester I’ll finally have some sort of feature done that I can show people. Don’t get me wrong, I have touched a lot of things in the code base as it is. Some of them were hard, some of them were easy. The important part was they all taught me different things. Now I need to piece them together and move towards a bigger goal, and that is the work I will be doing on Bug 686370 – Implement video playback statistics proposed in WHATWG; which will be done alongside with Dave Seifried and Chris De Cairos.

Looking forward to the coming weeks!

I borked something!

I’m so proud. No really, it’s awesome.

Anyway, over our reading week I noticed myself getting a bunch of bugmail from a bug that I couldn’t recall ever CC’ing myself to. This was rather strange I thought, so I figure I would check it out.

The ticket starts off at first with people looking which nightly build was the cause, trying to find the exact regression point. Eventually they made their way to my simple dumb fix for Unprefix Blob.mozSlice, basically just removing the moz prefix which is apart of an ongoing process/debate about adopting better standards because of WebKit on mobile browsers. Removing these prefixes will help prevent a situation in the mobile browsing market akin to Internet explorers dominance during the 90’s.

Anyway, it turns out I broke the fast upload feature for registered accounts on Mediafire. They can no longer upload files in FF13+.

Woo!