diff options
author | metamuffin <metamuffin@disroot.org> | 2023-10-03 14:55:26 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-10-03 14:55:26 +0200 |
commit | 520051f3319b5ba4e811d43b5ce3554761653df3 (patch) | |
tree | 86b341d8457e5bafc08af2cb2c067a8b6d649271 /web/script/player/profiles.ts | |
parent | 6b636bc73b8e44841d76a14fd3cb23af647b7165 (diff) | |
download | jellything-520051f3319b5ba4e811d43b5ce3554761653df3.tar jellything-520051f3319b5ba4e811d43b5ce3554761653df3.tar.bz2 jellything-520051f3319b5ba4e811d43b5ce3554761653df3.tar.zst |
more logging and fixes
Diffstat (limited to 'web/script/player/profiles.ts')
-rw-r--r-- | web/script/player/profiles.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/web/script/player/profiles.ts b/web/script/player/profiles.ts index 11b27c9..a768d47 100644 --- a/web/script/player/profiles.ts +++ b/web/script/player/profiles.ts @@ -1,5 +1,6 @@ import { OVar } from "../jshelper/mod.ts"; import { EncodingProfile, JhlsMetadata } from "./jhls.d.ts"; +import { Player } from "./player.ts"; const PROFILE_UP_FAC = 0.6 const PROFILE_DOWN_FAC = 0.8 @@ -11,7 +12,7 @@ export class ProfileSelector { profiles_subtitles: EncodingProfileExt[] = [] remux_bandwidth = new Map<number, { size: number, duration: number }>() - constructor(private bandwidth: OVar<number>, private metadata: JhlsMetadata) { + constructor(private player: Player, private bandwidth: OVar<number>, private metadata: JhlsMetadata) { for (let id = 0; id < metadata.extra_profiles.length; id++) { const p = metadata.extra_profiles[id]; if (p.audio) this.profiles_audio.push({ id, order: 0, ...p }) @@ -42,14 +43,21 @@ export class ProfileSelector { if (current_bitrate > this.bandwidth.value * PROFILE_DOWN_FAC && co + 1 < profs.length) { console.log("profile up"); profile.value = profs[co + 1] + this.log_change(track, profile.value) } if (next_bitrate < this.bandwidth.value * PROFILE_UP_FAC && co >= 0) { console.log("profile down"); profile.value = profs[co - 1] + this.log_change(track, profile.value) } // profile.value = profs[0] } + + log_change(track: number, p: EncodingProfileExt | undefined) { + const ps = p ? `transcoding profile ${p.id}` : `remuxed original` + this.player.logger?.log(`Track #${track} switched to ${ps}`) + } } function profile_byterate(p?: EncodingProfile, fallback = 0): number { |