Skip to content

Commit

Permalink
fix: (xgplayer-hls) sps parse case page crash
Browse files Browse the repository at this point in the history
  • Loading branch information
王伟 authored and xiyuyizhi committed Jan 30, 2024
1 parent 4439c94 commit eb101b3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/xgplayer-streaming-shared/src/net/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class Task {
this.alive = !!config.onProgress
!config.logger && (config.logger = new Logger('Loader'))
this._loaderType = type
this._loader = type === LoaderType.FETCH && !!window.fetch ? new FetchLoader() : new XhrLoader()
this._loader = type === LoaderType.FETCH && typeof fetch !== 'undefined' ? new FetchLoader() : new XhrLoader()
this._config = config
this._retryCount = 0
this._retryTimer = null
Expand Down
5 changes: 5 additions & 0 deletions packages/xgplayer-transmuxer/src/codec/hevc.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ export class HEVC {

const subLayerProfilePresentFlag = []
const subLayerLevelPresentFlag = []

if (maxSubLayersMinus1 > eg.bitsAvailable) {
throw new Error(`maxSubLayersMinus inavlid size ${maxSubLayersMinus1}`)
}

for (let j = 0; j < maxSubLayersMinus1; j++) {
subLayerProfilePresentFlag[j] = eg.readBits(1)
subLayerLevelPresentFlag[j] = eg.readBits(1)
Expand Down
4 changes: 4 additions & 0 deletions packages/xgplayer-transmuxer/src/utils/exp-golomb.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export class ExpGolomb {
if (this._bytesAvailable) this._loadWord()
}

get bitsAvailable () {
return this._bitsAvailable
}

_loadWord () {
const position = this._data.byteLength - this._bytesAvailable
const availableBytes = Math.min(4, this._bytesAvailable)
Expand Down

0 comments on commit eb101b3

Please sign in to comment.