From 3b76636bdf74f71e469dbd5d337abeaaccf4b487 Mon Sep 17 00:00:00 2001 From: keradoxchen Date: Mon, 9 Feb 2026 02:36:50 +0000 Subject: [PATCH] fix(h264): replace `self` with `this` in H264Context.decode() `self` refers to `window` in browser context, causing SPS parameters to be set on the global object instead of the H264Context instance. This prevents the decoder from ever being properly configured. --- core/decoders/h264.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/decoders/h264.js b/core/decoders/h264.js index a508b674..180106a3 100644 --- a/core/decoders/h264.js +++ b/core/decoders/h264.js @@ -196,9 +196,9 @@ export class H264Context { } if (parser.profileIdc !== null) { - self._profileIdc = parser.profileIdc; - self._constraintSet = parser.constraintSet; - self._levelIdc = parser.levelIdc; + this._profileIdc = parser.profileIdc; + this._constraintSet = parser.constraintSet; + this._levelIdc = parser.levelIdc; } if (this._decoder === null || this._decoder.state !== 'configured') { @@ -206,12 +206,12 @@ export class H264Context { Log.Warn("Missing key frame. Can't decode until one arrives"); continue; } - if (self._profileIdc === null) { + if (this._profileIdc === null) { Log.Warn('Cannot config decoder. Have not received SPS and PPS yet.'); continue; } - this._configureDecoder(self._profileIdc, self._constraintSet, - self._levelIdc); + this._configureDecoder(this._profileIdc, this._constraintSet, + this._levelIdc); } result = this._preparePendingFrame(timestamp);