forked from mirrors/gecko-dev
Automatic update from web-platform-tests WebKit export of https://bugs.webkit.org/show_bug.cgi?id=224604 (#28509) -- wpt-commits: f9df31ff0da1cfe9ce49dfffd9c99b636b82ae66 wpt-pr: 28509
30 lines
740 B
JavaScript
30 lines
740 B
JavaScript
class MockRTCRtpTransformer {
|
|
constructor(transformer) {
|
|
this.context = transformer;
|
|
this.start();
|
|
}
|
|
start()
|
|
{
|
|
this.reader = this.context.readable.getReader();
|
|
this.writer = this.context.writable.getWriter();
|
|
this.process();
|
|
this.context.options.port.postMessage("started " + this.context.options.mediaType + " " + this.context.options.side);
|
|
}
|
|
|
|
process()
|
|
{
|
|
this.reader.read().then(chunk => {
|
|
if (chunk.done)
|
|
return;
|
|
|
|
this.writer.write(chunk.value);
|
|
this.process();
|
|
});
|
|
}
|
|
};
|
|
|
|
onrtctransform = (event) => {
|
|
new MockRTCRtpTransformer(event.transformer);
|
|
};
|
|
|
|
self.postMessage("registered");
|