From 9a4ac54607b6404c589ee3f797065b611eda01aa Mon Sep 17 00:00:00 2001 From: Bernard Aboba Date: Fri, 29 Sep 2023 16:13:30 -0700 Subject: [PATCH] Set optimizeForLatency in decoder config When the encoder spits out a decoder configuration, set optimizeForLatency based on the encoder configuration of latencyPref. --- samples/encode-decode-worker/js/stream_worker.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/samples/encode-decode-worker/js/stream_worker.js b/samples/encode-decode-worker/js/stream_worker.js index f57fc53c..bc6d4b87 100644 --- a/samples/encode-decode-worker/js/stream_worker.js +++ b/samples/encode-decode-worker/js/stream_worker.js @@ -252,6 +252,8 @@ class pipeline { output: (chunk, cfg) => { if (cfg.decoderConfig) { cfg.decoderConfig.hardwareAcceleration = config.decHwAcceleration; + cfg.decoderConfig.optimizeForLatency = true; + if (config.latencyPref == 'quality') cfg.decoderConfig.optimizeForLatency = false; const decoderConfig = JSON.stringify(cfg.decoderConfig); self.postMessage({text: 'Configuration: ' + decoderConfig}); const configChunk =