File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
samples/encode-decode-worker/js Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ class pipeline {
152
152
153
153
EncodeVideoStream ( self , config ) {
154
154
return new TransformStream ( {
155
- start ( controller ) {
155
+ async start ( controller ) {
156
156
this . frameCounter = 0 ;
157
157
this . seqNo = 0 ;
158
158
this . keyframeIndex = 0 ;
@@ -196,17 +196,17 @@ class pipeline {
196
196
self . postMessage ( { severity : 'fatal' , text : `Encoder error: ${ e . message } ` } ) ;
197
197
}
198
198
} ) ;
199
- VideoEncoder . isConfigSupported ( config ) . then ( ( encoderSupport ) => {
200
- if ( encoderSupport . supported ) {
199
+ try {
200
+ const encoderSupport = await VideoEncoder . isConfigSupported ( config ) ;
201
+ if ( encoderSupport . supported ) {
201
202
this . encoder . configure ( encoderSupport . config ) ;
202
203
self . postMessage ( { text : 'Encoder successfully configured:\n' + JSON . stringify ( encoderSupport . config ) } ) ;
203
204
} else {
204
205
self . postMessage ( { severity : 'fatal' , text : 'Config not supported:\n' + JSON . stringify ( encoderSupport . config ) } ) ;
205
206
}
206
- } )
207
- . catch ( ( e ) => {
208
- self . postMessage ( { severity : 'fatal' , text : `Configuration error: ${ e . message } ` } ) ;
209
- } )
207
+ } catch ( e ) {
208
+ self . postMessage ( { severity : 'fatal' , text : `Configuration error: ${ e . message } ` } ) ;
209
+ }
210
210
} ,
211
211
transform ( frame , controller ) {
212
212
if ( this . pending_outputs <= 30 ) {
You can’t perform that action at this time.
0 commit comments