Open Bug 667206 Opened 14 years ago Updated 3 years ago

DrawImage fails on Motion JPG (mjpg)

Categories

(Core :: Graphics: Canvas2D, defect)

x86
macOS
defect

Tracking

()

People

(Reporter: humph, Unassigned)

References

Details

Attachments

(1 file)

Using an image element with a mjpg as the source for a drawImage() call results in us silently doing nothing. I think it's related to bug 667203, and how we consider the loading state of such images. From nsCanvasRenderingContext2D::DrawImage, we bail in 3323: 3315 if (!imgsurf) { 3316 // The canvas spec says that drawImage should draw the first frame 3317 // of animated images 3318 PRUint32 sfeFlags = nsLayoutUtils::SFE_WANT_FIRST_FRAME; 3319 nsLayoutUtils::SurfaceFromElementResult res = 3320 nsLayoutUtils::SurfaceFromElement(imgElt, sfeFlags); 3321 if (!res.mSurface) { 3322 // Spec says to silently do nothing if the element is still loading. 3323 return res.mIsStillLoading ? NS_OK : NS_ERROR_NOT_AVAILABLE; 3324 } Chrome and Safari happily draw the image into the canvas. As I said in bug 667203, they also both consider the image loaded upon the first frame coming down. I've attached a test case. If/when the network stream interrupts the transfer of frames, the canvas will suddenly get drawn, otherwise it remains white in Firefox.
(In reply to comment #1) > See bug 666855. The spec says Firefox is right (or trying to be right, I still don't get a poster frame or first frame drawn). I've filed a bug on the spec: http://www.w3.org/Bugs/Public/show_bug.cgi?id=13060
This is a different situation from the animated gif situation. The issue here is that the spec says: If the image argument is an HTMLImageElement object that is not fully decodable then the implementation must return without drawing anything. where "fully decodable" is defined as: When an img element is in the completely available state and the user agent can completely decode the media data without errors, then the img element is said to be fully decodable. and "Completely available" is defined as: The user agent has obtained all of the image data. whereas the test we use internally is: (status & imgIRequest::STATUS_LOAD_COMPLETE) == 0 which is not true for an mjpeg while a new frame is loading.... so if frames are coming down the wire continuously, this will never test true.
Depends on: 625012
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: