WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
177951
[MSE] Dead code in SourceBuffer::appendBufferTimerFired()
https://bugs.webkit.org/show_bug.cgi?id=177951
Summary
[MSE] Dead code in SourceBuffer::appendBufferTimerFired()
Enrique Ocaña
Reported
2017-10-05 10:51:05 PDT
The second block of code here[1] is never going to be run because the first block makes the vector to be non-empty: size_t appendSize = m_pendingAppendData.size(); if (!appendSize) { // Resize buffer for 0 byte appends so we always have a valid pointer. // We need to convey all appends, even 0 byte ones to |m_private| so // that it can clear its end of stream state if necessary. m_pendingAppendData.resize(1); } // Section 3.5.1 Segment Parser Loop //
https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#sourcebuffer-segment-parser-loop
// When the segment parser loop algorithm is invoked, run the following steps: // 1. Loop Top: If the input buffer is empty, then jump to the need more data step below. if (!m_pendingAppendData.size()) { sourceBufferPrivateAppendComplete(AppendSucceeded); return; } Probably the whole platform layer append operation could be avoided by removing the first block and just completing the append in the second code block. Am I missing something? [1]
https://github.com/WebKit/webkit/blob/624c264648af81a0cf6a3818db9d776d4d6ee15c/Source/WebCore/Modules/mediasource/SourceBuffer.cpp#L549
Attachments
Patch
(2.17 KB, patch)
2017-10-05 15:44 PDT
,
Enrique Ocaña
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Alicia Boya García
Comment 1
2017-10-05 15:18:02 PDT
The comment makes me suspect that `.resize(1)` should actually be `.reserveCapacity(1)` and that zero-length appends are not being handled correctly.
Enrique Ocaña
Comment 2
2017-10-05 15:44:40 PDT
Created
attachment 322926
[details]
Patch
Jer Noble
Comment 3
2017-10-05 15:54:16 PDT
This code was inherited from blink, and appears to have been totally re-written in blink since the merge.(In reply to Alicia Boya García from
comment #1
)
> The comment makes me suspect that `.resize(1)` should actually be > `.reserveCapacity(1)` and that zero-length appends are not being handled > correctly.
Seems to me that we can now change SourceBufferPrivate::append() to take a "Vector<unsigned char>&&" rather than a "void*, size_t". That would make this resize (or reserveCapacity) unnecessary, and also avoid a copy operation inside the private.
Enrique Ocaña
Comment 4
2017-10-05 16:10:21 PDT
Yes, Zan wants to do that change in a different patch but he'd like to have this dead code issue sorted out before sending his patch.
WebKit Commit Bot
Comment 5
2017-10-06 00:43:56 PDT
Comment on
attachment 322926
[details]
Patch Clearing flags on attachment: 322926 Committed
r222965
: <
http://trac.webkit.org/changeset/222965
>
WebKit Commit Bot
Comment 6
2017-10-06 00:43:58 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 7
2017-10-06 00:45:52 PDT
<
rdar://problem/34851791
>
Zan Dobersek
Comment 8
2017-10-06 02:22:08 PDT
(In reply to Enrique Ocaña from
comment #4
)
> Yes, Zan wants to do that change in a different patch but he'd like to have > this dead code issue sorted out before sending his patch.
See
bug #178003
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug