Bug 264516

Summary: Sending multiple `VideoFrame`s per `postMessage()` only sends duplicates of the first
Product: WebKit Reporter: daxpedda
Component: MediaAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: daxpedda, eric.carlson, jer.noble, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Mac (Intel)   
OS: macOS 13   

Description daxpedda 2023-11-09 13:44:50 PST
Sending more then one `VideoFrame` to a worker per `postMessage()` at once, sends as many `VideoFrame`s as there were sent, but they are all a duplicate of the first one.
I concluded that there are duplicates and not just malformed because when I try to send them back again with `postMessage()` I receive the following error:
"duplicate transferable for structured clone".

---

Window:
```js
const frame1 = new VideoFrame(new ArrayBuffer(4), { format: 'RGBA', codedWidth: 1, codedHeight: 1, timestamp: 0 })
const frame2 = new VideoFrame(new ArrayBuffer(8), { format: 'RGBA', codedWidth: 1, codedHeight: 2, timestamp: 0 })

const worker = new Worker('worker.js')
worker.postMessage([frame1, frame2])
```

Worker:
```js
addEventListener('message', (event) => {
    console.log(event.data[0].codedHeight)
    console.log(event.data[1].codedHeight)
})
```

Received:
```
1
1
```

Expected:
```
1
2
```
Comment 1 daxpedda 2023-11-09 13:49:55 PST
I've tried this only on Intel hardware:
- Safari Technology Preview 182 MacOS Ventura
- Safari 17.1 MacOS Ventura
- Safari 17.0 MacOS Monterey
Comment 2 Radar WebKit Bug Importer 2023-11-15 02:52:16 PST
<rdar://problem/118445968>
Comment 3 youenn fablet 2023-11-15 04:57:02 PST
Pull request: https://github.com/WebKit/WebKit/pull/20535
Comment 4 EWS 2023-11-15 08:51:34 PST
Committed 270772@main (b55438f2a83c): <https://commits.webkit.org/270772@main>

Reviewed commits have been landed. Closing PR #20535 and removing active labels.