Bug 237075

Summary: Add ability to convert FragmentedSharedBuffer to CMBlockBuffer
Product: WebKit Reporter: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Component: MediaAssignee: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Status: RESOLVED FIXED    
Severity: Normal CC: jer.noble, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 236754, 237078    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Description Jean-Yves Avenard [:jya] 2022-02-22 22:45:59 PST
Sub-task of bug 236754.

We can simplify the rewrite of SourceBufferParserWebM by using SharedBuffers instead.

Once we have built the SharedBuffer, we would want an easy way to convert it into a CMBlockBuffer without allocating memory or performing any copies.
Comment 1 Radar WebKit Bug Importer 2022-02-22 22:49:17 PST
<rdar://problem/89338447>
Comment 2 Jean-Yves Avenard [:jya] 2022-02-23 03:34:57 PST
Created attachment 452960 [details]
Patch
Comment 3 Jean-Yves Avenard [:jya] 2022-02-23 18:26:16 PST
Created attachment 453063 [details]
Patch
Comment 4 Jean-Yves Avenard [:jya] 2022-02-24 00:05:15 PST
Comment on attachment 453063 [details]
Patch

Unrelated failure, that code path isn't even used yet.
Comment 5 Jean-Yves Avenard [:jya] 2022-02-24 05:34:36 PST
Created attachment 453093 [details]
Patch
Comment 6 Jer Noble 2022-03-07 14:01:51 PST
Comment on attachment 453093 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=453093&action=review

> Source/WebCore/platform/SharedBuffer.cpp:162
> +    if (element->segment->size() - offsetInSegment >= length)

Is it possible for element->segment->size() to be < offsetInSegment? If not, maybe an ASSERT() that states such?
Comment 7 Jean-Yves Avenard [:jya] 2022-03-07 14:42:15 PST
Comment on attachment 453093 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=453093&action=review

>> Source/WebCore/platform/SharedBuffer.cpp:162
>> +    if (element->segment->size() - offsetInSegment >= length)
> 
> Is it possible for element->segment->size() to be < offsetInSegment? If not, maybe an ASSERT() that states such?

No, it's not possible. unless getSegmentForPosition is buggy and it's not :)
Comment 8 Jean-Yves Avenard [:jya] 2022-03-07 14:53:09 PST
Created attachment 454038 [details]
Patch
Comment 9 EWS 2022-03-07 17:40:26 PST
Committed r290968 (248147@main): <https://commits.webkit.org/248147@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 454038 [details].