Closed
Bug 993598
Opened 10 years ago
Closed 10 years ago
POST of MediaRecorder Blob drops first byte with long video slices
Categories
(Core :: Audio/Video: Recording, defect)
Tracking
()
RESOLVED
FIXED
mozilla32
People
(Reporter: andreasg123, Assigned: bechen)
References
(Blocks 1 open bug)
Details
Attachments
(2 files, 2 obsolete files)
1.38 KB,
text/html
|
Details | |
1.33 KB,
patch
|
bechen
:
review+
|
Details | Diff | Splinter Review |
When recording video with MediaRecorder and uploading the Blob with xhr POST, the first byte is dropped for long video slices (2 seconds works correctly, 20 seconds does not). In the sequence 1a 45 df a3, 1a is dropped. The missing byte is included in byte count reported in the content-length header of the request. I verified this by running WireShark on the HTTP traffic. When calling FileReader.readAsArrayBuffer on the Blob and uploading the ArrayBuffer instead, the missing byte is included. The video camera is a Logitech HD Pro Webcam C920 in case that makes a difference.
Updated•10 years ago
|
Component: General → Video/Audio: Recording
Product: Firefox → Core
Comment 1•10 years ago
|
||
Hi Benjamen, Could you help to check this problem?
Assignee | ||
Comment 2•10 years ago
|
||
We can reproduce the bug now include the 2s/20s blobs have different behaviors. Vincent: Should we move the bug to Necko?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(vchang)
Assignee | ||
Comment 3•10 years ago
|
||
Update status: There is a data byte threshold in EncodedBufferCache. If the data size accumulated over the threshold, we will create nsDOMTemporaryFileBlob, otherwise we create a nsDOMMemoryFile. I think that causes different behaviours for 2s and 20s blobs. About the missing 1 byte, now we suspect the macro |NS_InputStreamIsBuffered| somehow it will read 1 byte of the blob. http://dxr.mozilla.org/mozilla-central/source/content/base/src/nsXMLHttpRequest.cpp?from=nsxmlhttprequest.cpp#2732
Flags: needinfo?(vchang)
Assignee | ||
Comment 4•10 years ago
|
||
Here read 1 byte. http://dxr.mozilla.org/mozilla-central/source/content/base/src/nsXMLHttpRequest.cpp?from=nsxmlhttprequest.cpp#2732 And then http://dxr.mozilla.org/mozilla-central/source/content/base/src/nsDOMFile.cpp?from=nsDOMFile.cpp&case=true#792 or http://dxr.mozilla.org/mozilla-central/source/content/base/src/nsDOMFile.cpp?from=nsDOMFile.cpp&case=true#800 using mStarPos (now should be 1) instead the original start point mStart.
Assignee | ||
Comment 5•10 years ago
|
||
|nsDOMMemoryFile::GetInternalStream| retruns a seekable stream. |nsDOMTemporaryFileBlob::GetInternalStream| returns a non-seekable stream. Now I suspect the |nsTemporaryFileInputStream| does not implement nsISeekableStream.
Assignee | ||
Comment 6•10 years ago
|
||
Root cause: 1. http://dxr.mozilla.org/mozilla-central/source/content/base/src/nsXMLHttpRequest.cpp?from=nsxmlhttprequest.cpp#2732 2. http://dxr.mozilla.org/mozilla-central/source/xpcom/io/nsStreamUtils.cpp#671 3. http://dxr.mozilla.org/mozilla-central/source/xpcom/io/nsStreamUtils.cpp#658 The |TestInputStream| returns a NS_ERROR_ABORT. And http://dxr.mozilla.org/mozilla-central/source/netwerk/base/src/nsTemporaryFileInputStream.cpp#81 moving forward the mStartPos regardless the return value.
Assignee: nobody → bechen
Comment 7•10 years ago
|
||
OK, thanks, please help to fix it. :)
Assignee | ||
Comment 8•10 years ago
|
||
Attachment #8420806 -
Flags: feedback?(rlin)
Comment 9•10 years ago
|
||
Comment on attachment 8420806 [details] [diff] [review] bug-993598.patch Review of attachment 8420806 [details] [diff] [review]: ----------------------------------------------------------------- Could we have a test case for recording more than 20s without passing timeslice? ::: netwerk/base/src/nsTemporaryFileInputStream.cpp @@ +73,5 @@ > uint32_t write_result = 0; > nsresult rv = writer(this, closure, buf, > count - remainBufCount, bufCount, &write_result); > remainBufCount -= bufCount; > + if (NS_FAILED(rv)) { You can use NS_ENSURE_SUCCESS(res, ret)
Attachment #8420806 -
Flags: feedback?(rlin) → feedback+
Assignee | ||
Comment 10•10 years ago
|
||
(In reply to Randy Lin [:rlin] from comment #9) > Comment on attachment 8420806 [details] [diff] [review] > bug-993598.patch > > Review of attachment 8420806 [details] [diff] [review]: > ----------------------------------------------------------------- > > Could we have a test case for recording more than 20s without passing > timeslice? Yes, bug 1008797 will do it. We may add more network tests there.
Assignee | ||
Comment 11•10 years ago
|
||
Attachment #8420806 -
Attachment is obsolete: true
Attachment #8420845 -
Flags: review?(roc)
Attachment #8420845 -
Flags: review?(roc) → review+
Assignee | ||
Comment 12•10 years ago
|
||
r=roc try server: https://tbpl.mozilla.org/?tree=Try&rev=558497feb80c
Attachment #8420845 -
Attachment is obsolete: true
Attachment #8421555 -
Flags: review+
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Comment 13•10 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/cfb4a97f2fbf
Keywords: checkin-needed
Assignee | ||
Comment 14•10 years ago
|
||
Randy: Do we need to uplift the patch to 1.2 1.3 1.4 etc...?
Flags: needinfo?(rlin)
Reporter | ||
Comment 16•10 years ago
|
||
As I'm getting all these email notifications, I had a look at the code being patched. That code assumes that PR_Read always reads as many bytes as asked as long as there isn't an error. In my opinion, it would be better to write read_result bytes and advance mStartPos by that much. If you also wanted to handle writer writing less than asked, you would need an inner loop.
Comment 17•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/cfb4a97f2fbf
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
You need to log in
before you can comment on or make changes to this bug.
Description
•