diff options
| author | metamuffin <metamuffin@disroot.org> | 2023-10-24 07:40:51 +0200 | 
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2023-10-24 07:40:51 +0200 | 
| commit | b462195f2dcfe457eae7791c14e4b834b2d5ab29 (patch) | |
| tree | 492ba43952fa6798320f2b2bb4d4bd5484e2e4f2 /web/script/player/profiles.ts | |
| parent | 6e9ccad881a7f887599bc8f3f6b9ca2424a2cc5e (diff) | |
| parent | 55f7f06cecd5b6f5661f6f22e8bb3e0448b9713a (diff) | |
| download | jellything-b462195f2dcfe457eae7791c14e4b834b2d5ab29.tar jellything-b462195f2dcfe457eae7791c14e4b834b2d5ab29.tar.bz2 jellything-b462195f2dcfe457eae7791c14e4b834b2d5ab29.tar.zst | |
Merge branch 'master' of codeberg.org:metamuffin/jellything
Diffstat (limited to 'web/script/player/profiles.ts')
| -rw-r--r-- | web/script/player/profiles.ts | 13 | 
1 files changed, 10 insertions, 3 deletions
| diff --git a/web/script/player/profiles.ts b/web/script/player/profiles.ts index a768d47..caa46bd 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 { test_media_capability } from "./mediacaps.ts";  import { Player } from "./player.ts";  const PROFILE_UP_FAC = 0.6 @@ -33,19 +34,25 @@ export class ProfileSelector {          if (i.subtitles) return this.profiles_subtitles          return []      } -    select_optimal_profile(track: number, profile: OVar<EncodingProfileExt | undefined>) { +    async remux_supported(track: number): Promise<boolean> { +        return await test_media_capability(this.metadata.tracks[track].info) +    } +    async select_optimal_profile(track: number, profile: OVar<EncodingProfileExt | undefined>) {          const profs = this.profile_list_for_track(track) -        const co = profile.value?.order ?? -1 +        const sup_remux = await this.remux_supported(track); +        const min_prof = sup_remux ? -1 : 0 +        const co = profile.value?.order ?? min_prof          const current_bitrate = profile_byterate(profs[co], 5000 * 1000)          const next_bitrate = profile_byterate(profs[co - 1], 5000 * 1000)          // console.log({ current_bitrate, next_bitrate, co, bandwidth: this.bandwidth.value * 8 }); +        if (!sup_remux && !profile.value) profile.value = profs[co];          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) { +        if (next_bitrate < this.bandwidth.value * PROFILE_UP_FAC && co > min_prof) {              console.log("profile down");              profile.value = profs[co - 1]              this.log_change(track, profile.value) | 
