movi-player 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/demuxer.js CHANGED
@@ -283,7 +283,7 @@ class MoviVideoDecoder {
283
283
  }
284
284
  async configure(A2, v2, j2 = 0) {
285
285
  if (this.currentTrack = A2, this.targetFps = j2, this.currentProfile = A2.profile, this.useSoftware = false, this.requiresSoftware = false, this.isAnnexBSource = false, this.openGopErrorCount = 0, this.hardwareRetryCount = 0, this.lastHardwareRetryTime = 0, this.swDecoder && (this.swDecoder.close(), this.swDecoder = null), this.forceSoftware) return r.info(f, "Force software decoding enabled, using WASM decoder"), this.useSoftware = true, this.initSoftwareDecoder();
286
- if (!("VideoDecoder" in window)) return r.error(f, "WebCodecs VideoDecoder not supported"), false;
286
+ if (!("VideoDecoder" in window)) return r.warn(f, "WebCodecs VideoDecoder not supported — falling back to software decoder"), this.useSoftware = true, this.initSoftwareDecoder();
287
287
  let b2 = CodecParser.getCodecString(A2.codec, A2.extradata);
288
288
  if (b2 || (r.debug(f, "CodecParser returned null, falling back to manual mapping"), b2 = this.mapCodecToWebCodecs(A2.codec, A2.width, A2.height, A2.profile, A2.level)), !b2) return r.error(f, `Unsupported codec: ${A2.codec}`), false;
289
289
  const t2 = { codec: b2, codedWidth: A2.width, codedHeight: A2.height, hardwareAcceleration: "prefer-hardware" };
@@ -1516,7 +1516,7 @@ async function createMoviModule(A2 = {}) {
1516
1516
  this.message = `Program terminated with exit(${A3})`, this.status = A3;
1517
1517
  }
1518
1518
  }
1519
- var $2, H2, c2, p2, m2, G2, _2, J2, h2, N2, g2, I2, P2, D2 = (A3) => {
1519
+ var $2, c2, H2, p2, m2, G2, _2, J2, h2, N2, g2, I2, P2, D2 = (A3) => {
1520
1520
  for (; A3.length > 0; ) A3.shift()(Module);
1521
1521
  }, L2 = [], O2 = (A3) => L2.push(A3), y = [], K = (A3) => y.push(A3), C = true, T = (A3) => A3 < -9007199254740992 || A3 > 9007199254740992 ? NaN : Number(A3), M = new TextDecoder(), S = (A3, v3, r3, j3) => {
1522
1522
  var b3 = v3 + r3;
@@ -2393,16 +2393,16 @@ async function createMoviModule(A2 = {}) {
2393
2393
  return I2.grow(v3), B2(), 1;
2394
2394
  } catch (A4) {
2395
2395
  }
2396
- }, $A = {}, HA = () => {
2397
- if (!HA.strings) {
2396
+ }, $A = {}, cA = () => {
2397
+ if (!cA.strings) {
2398
2398
  var A3 = { USER: "web_user", LOGNAME: "web_user", PATH: "/", PWD: "/", HOME: "/home/web_user", LANG: (globalThis.navigator?.language ?? "C").replace("-", "_") + ".UTF-8", _: t2 || "./this.program" };
2399
2399
  for (var v3 in $A) void 0 === $A[v3] ? delete A3[v3] : A3[v3] = $A[v3];
2400
2400
  var r3 = [];
2401
2401
  for (var v3 in A3) r3.push(`${v3}=${A3[v3]}`);
2402
- HA.strings = r3;
2402
+ cA.strings = r3;
2403
2403
  }
2404
- return HA.strings;
2405
- }, cA = (A3) => {
2404
+ return cA.strings;
2405
+ }, HA = (A3) => {
2406
2406
  try {
2407
2407
  return A3();
2408
2408
  } catch (A4) {
@@ -2435,11 +2435,11 @@ async function createMoviModule(A2 = {}) {
2435
2435
  }
2436
2436
  return pA.callstackFuncToId.get(A3);
2437
2437
  }, maybeStopUnwind() {
2438
- pA.currData && pA.state === pA.State.Unwinding && 0 === pA.exportCallStack.length && (pA.state = pA.State.Normal, cA(h2), "undefined" != typeof Fibers && Fibers.trampoline());
2438
+ pA.currData && pA.state === pA.State.Unwinding && 0 === pA.exportCallStack.length && (pA.state = pA.State.Normal, HA(h2), "undefined" != typeof Fibers && Fibers.trampoline());
2439
2439
  }, whenDone: () => new Promise((A3, v3) => {
2440
2440
  pA.asyncPromiseHandlers = { resolve: A3, reject: v3 };
2441
2441
  }), allocateData() {
2442
- var A3 = c2(12 + pA.StackSize);
2442
+ var A3 = H2(12 + pA.StackSize);
2443
2443
  return pA.setDataHeader(A3, A3 + 12, pA.StackSize), pA.setDataRewindFunc(A3), A3;
2444
2444
  }, setDataHeader(A3, v3, r3) {
2445
2445
  a2[A3 >>> 2 >>> 0] = v3, a2[A3 + 4 >>> 2 >>> 0] = v3 + r3;
@@ -2458,7 +2458,7 @@ async function createMoviModule(A2 = {}) {
2458
2458
  var v3 = false, r3 = false;
2459
2459
  A3((A4 = 0) => {
2460
2460
  if (!x2 && (pA.handleSleepReturnValue = A4, v3 = true, r3)) {
2461
- pA.state = pA.State.Rewinding, cA(() => N2(pA.currData)), "undefined" != typeof MainLoop && MainLoop.func && MainLoop.resume();
2461
+ pA.state = pA.State.Rewinding, HA(() => N2(pA.currData)), "undefined" != typeof MainLoop && MainLoop.func && MainLoop.resume();
2462
2462
  var j3, b3 = false;
2463
2463
  try {
2464
2464
  j3 = pA.doRewind(pA.currData);
@@ -2472,8 +2472,8 @@ async function createMoviModule(A2 = {}) {
2472
2472
  }
2473
2473
  if (b3 && !t3) throw j3;
2474
2474
  }
2475
- }), r3 = true, v3 || (pA.state = pA.State.Unwinding, pA.currData = pA.allocateData(), "undefined" != typeof MainLoop && MainLoop.func && MainLoop.pause(), cA(() => J2(pA.currData)));
2476
- } else pA.state === pA.State.Rewinding ? (pA.state = pA.State.Normal, cA(g2), H2(pA.currData), pA.currData = null, pA.sleepCallbacks.forEach(oA)) : d2(`invalid state: ${pA.state}`);
2475
+ }), r3 = true, v3 || (pA.state = pA.State.Unwinding, pA.currData = pA.allocateData(), "undefined" != typeof MainLoop && MainLoop.func && MainLoop.pause(), HA(() => J2(pA.currData)));
2476
+ } else pA.state === pA.State.Rewinding ? (pA.state = pA.State.Normal, HA(g2), c2(pA.currData), pA.currData = null, pA.sleepCallbacks.forEach(oA)) : d2(`invalid state: ${pA.state}`);
2477
2477
  return pA.handleSleepReturnValue;
2478
2478
  }
2479
2479
  }, handleAsync: (A3) => pA.handleSleep(async (v3) => {
@@ -2532,7 +2532,7 @@ async function createMoviModule(A2 = {}) {
2532
2532
  }
2533
2533
  return $2.set(A3, j3), j3;
2534
2534
  }, Module.UTF8ToString = w, Module.lengthBytesUTF8 = Q, Module.stringToNewUTF8 = (A3) => {
2535
- var v3 = Q(A3) + 1, r3 = c2(v3);
2535
+ var v3 = Q(A3) + 1, r3 = H2(v3);
2536
2536
  return r3 && kA(A3, r3, v3), r3;
2537
2537
  }, Module.FS = FS;
2538
2538
  var LA, OA = { b: function(A3, v3, r3, j3) {
@@ -2770,14 +2770,14 @@ async function createMoviModule(A2 = {}) {
2770
2770
  }, y: function(A3, v3) {
2771
2771
  A3 >>>= 0, v3 >>>= 0;
2772
2772
  var r3 = 0, j3 = 0;
2773
- for (var b3 of HA()) {
2773
+ for (var b3 of cA()) {
2774
2774
  var t3 = v3 + r3;
2775
2775
  a2[A3 + j3 >>> 2 >>> 0] = t3, r3 += kA(b3, t3, 1 / 0) + 1, j3 += 4;
2776
2776
  }
2777
2777
  return 0;
2778
2778
  }, z: function(A3, v3) {
2779
2779
  A3 >>>= 0, v3 >>>= 0;
2780
- var r3 = HA();
2780
+ var r3 = cA();
2781
2781
  a2[A3 >>> 2 >>> 0] = r3.length;
2782
2782
  var j3 = 0;
2783
2783
  for (var b3 of r3) j3 += Q(b3) + 1;
@@ -2862,7 +2862,7 @@ async function createMoviModule(A2 = {}) {
2862
2862
  return LA = await async function() {
2863
2863
  function A3(A4, v4) {
2864
2864
  return LA = A4.exports, function(A5) {
2865
- Module._movi_create = A5.J, H2 = Module._free = A5.K, Module._movi_set_file_size = A5.L, Module._movi_destroy = A5.M, Module._movi_open = A5.N, Module._movi_set_log_level = A5.O, Module._movi_enable_audio_downmix = A5.P, Module._movi_get_format_name = A5.Q, Module._movi_get_metadata_title = A5.R, Module._movi_enable_decoder = A5.S, Module._movi_send_packet = A5.T, Module._movi_set_skip_frame = A5.U, Module._movi_receive_frame = A5.V, Module._movi_get_frame_rgba = A5.W, Module._movi_get_frame_rgba_size = A5.X, Module._movi_get_frame_rgba_linesize = A5.Y, Module._movi_decode_subtitle = A5.Z, Module._movi_get_subtitle_text = A5._, Module._movi_get_subtitle_times = A5.$, Module._movi_get_subtitle_image_info = A5.aa, Module._movi_get_subtitle_image_data = A5.ba, Module._movi_free_subtitle = A5.ca, Module._movi_get_frame_pts = A5.da, Module._movi_flush_decoder = A5.ea, Module._movi_clear_prefetched_cues = A5.fa, Module._movi_prefetch_subtitle_cues = A5.ga, c2 = Module._malloc = A5.ha, Module._movi_get_prefetched_cue_count = A5.ia, Module._movi_get_prefetched_cue = A5.ja, Module._movi_get_frame_width = A5.ka, Module._movi_get_frame_height = A5.la, Module._movi_get_frame_format = A5.ma, Module._movi_get_frame_data = A5.na, Module._movi_get_frame_linesize = A5.oa, Module._movi_get_frame_samples = A5.pa, Module._movi_get_frame_channels = A5.qa, Module._movi_get_frame_sample_rate = A5.ra, Module._movi_get_duration = A5.sa, Module._movi_get_start_time = A5.ta, Module._movi_get_stream_count = A5.ua, Module._movi_get_stream_info = A5.va, Module._movi_get_extradata = A5.wa, Module._movi_seek_to = A5.xa, Module._movi_read_frame = A5.ya, Module._movi_get_chapter_count = A5.za, Module._movi_get_chapter_start = A5.Aa, Module._movi_get_chapter_end = A5.Ba, Module._movi_get_chapter_title = A5.Ca, Module._movi_stretch_new = A5.Da, Module._movi_stretch_delete = A5.Ea, Module._movi_stretch_reset = A5.Fa, Module._movi_stretch_set_transpose_semitones = A5.Ga, Module._movi_stretch_input_latency = A5.Ha, Module._movi_stretch_output_latency = A5.Ia, Module._movi_stretch_process = A5.Ja, Module._movi_thumbnail_create = A5.Ka, Module._movi_thumbnail_open = A5.La, Module._movi_thumbnail_read_keyframe = A5.Ma, Module._movi_thumbnail_get_packet_data = A5.Na, Module._movi_thumbnail_get_stream_info = A5.Oa, Module._movi_thumbnail_get_extradata = A5.Pa, Module._movi_thumbnail_decode_frame_yuv = A5.Qa, Module._movi_thumbnail_get_plane_data = A5.Ra, Module._movi_thumbnail_get_plane_linesize = A5.Sa, Module._movi_thumbnail_get_frame_width = A5.Ta, Module._movi_thumbnail_get_frame_height = A5.Ua, Module._movi_thumbnail_decode_frame = A5.Va, Module._movi_thumbnail_clear_buffer = A5.Wa, Module._movi_thumbnail_destroy = A5.Xa, p2 = A5._a, m2 = A5.$a, G2 = A5.ab, _2 = A5.bb, A5.cb, A5.db, A5.eb, A5.fb, A5.gb, A5.hb, A5.ib, A5.jb, A5.kb, A5.lb, A5.mb, A5.nb, A5.ob, A5.pb, A5.qb, A5.rb, A5.sb, A5.tb, A5.ub, A5.vb, A5.wb, A5.xb, A5.yb, A5.zb, A5.Ab, A5.Bb, A5.Cb, A5.Db, A5.Eb, A5.Fb, A5.Gb, A5.Hb, A5.Ib, A5.Jb, A5.Kb, A5.Lb, A5.Mb, A5.Nb, A5.Ob, A5.Pb, A5.Qb, A5.Rb, A5.Sb, A5.Tb, A5.Ub, A5.Vb, A5.Wb, A5.Xb, A5.Yb, A5.Zb, A5._b, A5.$b, A5.ac, J2 = A5.bc, h2 = A5.cc, N2 = A5.dc, g2 = A5.ec, I2 = A5.H, Module._ff_h264_cabac_tables = A5.Ya.value >>> 0, P2 = A5.Za;
2865
+ Module._movi_create = A5.J, c2 = Module._free = A5.K, Module._movi_set_file_size = A5.L, Module._movi_destroy = A5.M, Module._movi_open = A5.N, Module._movi_set_log_level = A5.O, Module._movi_enable_audio_downmix = A5.P, Module._movi_get_format_name = A5.Q, Module._movi_get_metadata_title = A5.R, Module._movi_enable_decoder = A5.S, Module._movi_send_packet = A5.T, Module._movi_set_skip_frame = A5.U, Module._movi_receive_frame = A5.V, Module._movi_get_frame_rgba = A5.W, Module._movi_get_frame_rgba_size = A5.X, Module._movi_get_frame_rgba_linesize = A5.Y, Module._movi_decode_subtitle = A5.Z, Module._movi_get_subtitle_text = A5._, Module._movi_get_subtitle_times = A5.$, Module._movi_get_subtitle_image_info = A5.aa, Module._movi_get_subtitle_image_data = A5.ba, Module._movi_free_subtitle = A5.ca, Module._movi_get_frame_pts = A5.da, Module._movi_flush_decoder = A5.ea, Module._movi_clear_prefetched_cues = A5.fa, Module._movi_prefetch_subtitle_cues = A5.ga, H2 = Module._malloc = A5.ha, Module._movi_get_prefetched_cue_count = A5.ia, Module._movi_get_prefetched_cue = A5.ja, Module._movi_get_frame_width = A5.ka, Module._movi_get_frame_height = A5.la, Module._movi_get_frame_format = A5.ma, Module._movi_get_frame_data = A5.na, Module._movi_get_frame_linesize = A5.oa, Module._movi_get_frame_samples = A5.pa, Module._movi_get_frame_channels = A5.qa, Module._movi_get_frame_sample_rate = A5.ra, Module._movi_get_duration = A5.sa, Module._movi_get_start_time = A5.ta, Module._movi_get_stream_count = A5.ua, Module._movi_get_stream_info = A5.va, Module._movi_get_extradata = A5.wa, Module._movi_seek_to = A5.xa, Module._movi_read_frame = A5.ya, Module._movi_get_chapter_count = A5.za, Module._movi_get_chapter_start = A5.Aa, Module._movi_get_chapter_end = A5.Ba, Module._movi_get_chapter_title = A5.Ca, Module._movi_stretch_new = A5.Da, Module._movi_stretch_delete = A5.Ea, Module._movi_stretch_reset = A5.Fa, Module._movi_stretch_set_transpose_semitones = A5.Ga, Module._movi_stretch_input_latency = A5.Ha, Module._movi_stretch_output_latency = A5.Ia, Module._movi_stretch_process = A5.Ja, Module._movi_thumbnail_create = A5.Ka, Module._movi_thumbnail_open = A5.La, Module._movi_thumbnail_read_keyframe = A5.Ma, Module._movi_thumbnail_get_packet_data = A5.Na, Module._movi_thumbnail_get_stream_info = A5.Oa, Module._movi_thumbnail_get_extradata = A5.Pa, Module._movi_thumbnail_decode_frame_yuv = A5.Qa, Module._movi_thumbnail_get_plane_data = A5.Ra, Module._movi_thumbnail_get_plane_linesize = A5.Sa, Module._movi_thumbnail_get_frame_width = A5.Ta, Module._movi_thumbnail_get_frame_height = A5.Ua, Module._movi_thumbnail_decode_frame = A5.Va, Module._movi_thumbnail_clear_buffer = A5.Wa, Module._movi_thumbnail_destroy = A5.Xa, p2 = A5._a, m2 = A5.$a, G2 = A5.ab, _2 = A5.bb, A5.cb, A5.db, A5.eb, A5.fb, A5.gb, A5.hb, A5.ib, A5.jb, A5.kb, A5.lb, A5.mb, A5.nb, A5.ob, A5.pb, A5.qb, A5.rb, A5.sb, A5.tb, A5.ub, A5.vb, A5.wb, A5.xb, A5.yb, A5.zb, A5.Ab, A5.Bb, A5.Cb, A5.Db, A5.Eb, A5.Fb, A5.Gb, A5.Hb, A5.Ib, A5.Jb, A5.Kb, A5.Lb, A5.Mb, A5.Nb, A5.Ob, A5.Pb, A5.Qb, A5.Rb, A5.Sb, A5.Tb, A5.Ub, A5.Vb, A5.Wb, A5.Xb, A5.Yb, A5.Zb, A5._b, A5.$b, A5.ac, J2 = A5.bc, h2 = A5.cc, N2 = A5.dc, g2 = A5.ec, I2 = A5.H, Module._ff_h264_cabac_tables = A5.Ya.value >>> 0, P2 = A5.Za;
2866
2866
  }(LA = function(A5) {
2867
2867
  var v5, r3 = (A6) => (v6) => A6(v6) >>> 0;
2868
2868
  return (A5 = Object.assign({}, A5)).ha = r3(A5.ha), A5.ab = r3(A5.ab), A5.bb = (v5 = A5.bb, () => v5() >>> 0), A5;
@@ -49134,7 +49134,7 @@ function d() {
49134
49134
  function $() {
49135
49135
  return null !== x;
49136
49136
  }
49137
- const H = "HttpSource", c = 2097152, p = 262144e3, m = 131072;
49137
+ const c = "HttpSource", H = 2097152, p = 262144e3, m = 131072;
49138
49138
  class HttpSource {
49139
49139
  url;
49140
49140
  headers;
@@ -49164,7 +49164,7 @@ class HttpSource {
49164
49164
  consecutiveForceRestarts = 0;
49165
49165
  lastForceRestartTime = 0;
49166
49166
  MAX_FORCE_RESTARTS = 3;
49167
- bufferSize = c;
49167
+ bufferSize = H;
49168
49168
  totalBytesDownloaded = 0;
49169
49169
  streamStartTime = 0;
49170
49170
  lastSpeedBytes = 0;
@@ -49175,7 +49175,7 @@ class HttpSource {
49175
49175
  this.url = A2, this.headers = v2, this.maxBufferSizeMB = r2 ?? 250, this.initBuffer();
49176
49176
  }
49177
49177
  initBuffer() {
49178
- this.bufferSize = c, this.resizeBuffer(this.bufferSize);
49178
+ this.bufferSize = H, this.resizeBuffer(this.bufferSize);
49179
49179
  }
49180
49180
  setMaxBufferSize(A2) {
49181
49181
  if (A2 > 0 && (this.maxBufferSizeMB = A2, this.size > 0)) {
@@ -49193,13 +49193,13 @@ class HttpSource {
49193
49193
  return this.rangeUnsupported;
49194
49194
  }
49195
49195
  resizeBuffer(A2) {
49196
- const v2 = 1024 * this.maxBufferSizeMB * 1024, j2 = Math.max(c, Math.min(v2, A2));
49196
+ const v2 = 1024 * this.maxBufferSizeMB * 1024, j2 = Math.max(H, Math.min(v2, A2));
49197
49197
  if (this.bufferSize !== j2 || !this.sharedBuffer && !this.fallbackBuffer) {
49198
49198
  this.bufferSize = j2;
49199
49199
  try {
49200
- "undefined" != typeof SharedArrayBuffer && crossOriginIsolated ? (this.sharedBuffer = new SharedArrayBuffer(24 + this.bufferSize), this.headerView = new Int32Array(this.sharedBuffer, 0, 6), this.dataView = new Uint8Array(this.sharedBuffer, 24, this.bufferSize), this.useSharedBuffer = true, r.info(H, `Using SharedArrayBuffer for zero-copy streaming (${(this.bufferSize / 1024 / 1024).toFixed(2)} MB)`)) : (this.fallbackBuffer = new Uint8Array(this.bufferSize), r.info(H, `Using standard ArrayBuffer (${(this.bufferSize / 1024 / 1024).toFixed(2)} MB)`));
49200
+ "undefined" != typeof SharedArrayBuffer && crossOriginIsolated ? (this.sharedBuffer = new SharedArrayBuffer(24 + this.bufferSize), this.headerView = new Int32Array(this.sharedBuffer, 0, 6), this.dataView = new Uint8Array(this.sharedBuffer, 24, this.bufferSize), this.useSharedBuffer = true, r.info(c, `Using SharedArrayBuffer for zero-copy streaming (${(this.bufferSize / 1024 / 1024).toFixed(2)} MB)`)) : (this.fallbackBuffer = new Uint8Array(this.bufferSize), r.info(c, `Using standard ArrayBuffer (${(this.bufferSize / 1024 / 1024).toFixed(2)} MB)`));
49201
49201
  } catch {
49202
- this.fallbackBuffer = new Uint8Array(this.bufferSize), r.warn(H, `SharedArrayBuffer init failed, using fallback (${(this.bufferSize / 1024 / 1024).toFixed(2)} MB)`);
49202
+ this.fallbackBuffer = new Uint8Array(this.bufferSize), r.warn(c, `SharedArrayBuffer init failed, using fallback (${(this.bufferSize / 1024 / 1024).toFixed(2)} MB)`);
49203
49203
  }
49204
49204
  }
49205
49205
  }
@@ -49312,7 +49312,7 @@ class HttpSource {
49312
49312
  this._contentDispositionFilename = A3;
49313
49313
  }
49314
49314
  }
49315
- this._contentDispositionFilename && r.debug(H, `Content-Disposition filename: ${this._contentDispositionFilename}`);
49315
+ this._contentDispositionFilename && r.debug(c, `Content-Disposition filename: ${this._contentDispositionFilename}`);
49316
49316
  }
49317
49317
  async buildRequestHeaders(A2) {
49318
49318
  return A2 ? { ...this.headers, Range: `bytes=${A2.offset}-${A2.offset + A2.length - 1}` } : { ...this.headers };
@@ -49320,9 +49320,9 @@ class HttpSource {
49320
49320
  async getSize() {
49321
49321
  if (this.size >= 0) return this.size;
49322
49322
  try {
49323
- this.size = await this.resolveSize(), r.debug(H, `File size: ${this.size} bytes`);
49323
+ this.size = await this.resolveSize(), r.debug(c, `File size: ${this.size} bytes`);
49324
49324
  const A2 = 1024 * this.maxBufferSizeMB * 1024, v2 = this.size <= A2, j2 = v2 ? this.size : Math.floor(0.08 * this.size);
49325
- return this.resizeBuffer(j2), r.info(H, `Buffer: ${(this.bufferSize / 1024 / 1024).toFixed(1)}MB ${v2 ? "(full file cache)" : "(8% sliding window)"} for ${(this.size / 1024 / 1024).toFixed(1)}MB file`), this.size;
49325
+ return this.resizeBuffer(j2), r.info(c, `Buffer: ${(this.bufferSize / 1024 / 1024).toFixed(1)}MB ${v2 ? "(full file cache)" : "(8% sliding window)"} for ${(this.size / 1024 / 1024).toFixed(1)}MB file`), this.size;
49326
49326
  } catch (A2) {
49327
49327
  const v2 = A2.message || "";
49328
49328
  if ("TypeError" === A2.name && v2.includes("Failed to fetch") && !v2.includes("HTTP")) throw new Error("Failed to fetch video resource. Check your connection or CORS settings.");
@@ -49376,11 +49376,11 @@ class HttpSource {
49376
49376
  return f2.set(t2.subarray(E2, E2 + v2)), this.useSharedBuffer && this.headerView && r2 !== Atomics.load(this.headerView, 5) ? null : f2;
49377
49377
  }
49378
49378
  async startStream(A2) {
49379
- if (this.fullyBuffered) r.debug(H, `startStream(${A2}): skipped — file fully cached`);
49379
+ if (this.fullyBuffered) r.debug(c, `startStream(${A2}): skipped — file fully cached`);
49380
49380
  else {
49381
- if (await this.stopStream(), r.info(H, `Starting stream from ${A2}`), this.streamError = null, this.size > 0 && A2 >= this.size) return r.debug(H, "Requested stream at or past EOF. Ignoring."), this.atomicSetBufferStart(A2), this.atomicSetWritePos(0), void this.atomicSetStreaming(false);
49381
+ if (await this.stopStream(), r.info(c, `Starting stream from ${A2}`), this.streamError = null, this.size > 0 && A2 >= this.size) return r.debug(c, "Requested stream at or past EOF. Ignoring."), this.atomicSetBufferStart(A2), this.atomicSetWritePos(0), void this.atomicSetStreaming(false);
49382
49382
  this.atomicSetBufferStart(A2), this.atomicSetWritePos(0), this.atomicSetStreaming(true), this.atomicIncrementVersion(), this.fullyBuffered = false, this.maxBufferedEnd = A2, this.abortController = new AbortController(), this.readStreamBackground(A2).catch((A3) => {
49383
- r.error(H, "Background stream failed fatally", A3), this.atomicSetStreaming(false);
49383
+ r.error(c, "Background stream failed fatally", A3), this.atomicSetStreaming(false);
49384
49384
  });
49385
49385
  }
49386
49386
  }
@@ -49390,11 +49390,11 @@ class HttpSource {
49390
49390
  const f2 = this.getBuffer();
49391
49391
  let n2;
49392
49392
  if (n2 = j2 ? this.atomicGetBufferStart() + this.atomicGetWritePos() : A2, this.size > 0 && n2 >= this.size) {
49393
- r.debug(H, "Stream reached end of requested range (EOF)"), this.atomicSetStreaming(false);
49393
+ r.debug(c, "Stream reached end of requested range (EOF)"), this.atomicSetStreaming(false);
49394
49394
  break;
49395
49395
  }
49396
49396
  const F2 = this.size > 0 && this.bufferSize >= this.size ? this.size : Math.floor(Math.min(p, 0.9 * this.bufferSize)), l2 = this.size > 0 ? Math.min(n2 + F2 - 1, this.size - 1) : n2 + F2 - 1;
49397
- r.debug(H, `Fetching range: ${n2}-${l2} (max ${(F2 / 1024 / 1024).toFixed(1)}MB)`);
49397
+ r.debug(c, `Fetching range: ${n2}-${l2} (max ${(F2 / 1024 / 1024).toFixed(1)}MB)`);
49398
49398
  const k2 = await fetch(this.url, { headers: await this.buildRequestHeaders({ offset: n2, length: l2 - n2 + 1 }), cache: "no-store", signal: this.abortController.signal });
49399
49399
  if (200 === k2.status) {
49400
49400
  if (b2++, b2 <= 3) {
@@ -49402,21 +49402,21 @@ class HttpSource {
49402
49402
  k2.body?.cancel();
49403
49403
  } catch {
49404
49404
  }
49405
- r.warn(H, `Server returned 200 instead of 206 (attempt ${b2}/3). CDN may be caching — retrying in 1500ms...`), await new Promise((A3) => setTimeout(A3, 1500));
49405
+ r.warn(c, `Server returned 200 instead of 206 (attempt ${b2}/3). CDN may be caching — retrying in 1500ms...`), await new Promise((A3) => setTimeout(A3, 1500));
49406
49406
  continue;
49407
49407
  }
49408
- if (0 === A2) return r.warn(H, "No Range support after 3 retries — falling back to sequential playback."), void await this.consumeNonRangeStream(k2);
49408
+ if (0 === A2) return r.warn(c, "No Range support after 3 retries — falling back to sequential playback."), void await this.consumeNonRangeStream(k2);
49409
49409
  try {
49410
49410
  k2.body?.cancel();
49411
49411
  } catch {
49412
49412
  }
49413
49413
  const v3 = new Error("Server does not support range requests.");
49414
- throw r.error(H, `Server returned 200 for offset ${A2}; range requests not supported.`), this.abortController?.abort(), this.atomicSetStreaming(false), this.streamError = v3, v3;
49414
+ throw r.error(c, `Server returned 200 for offset ${A2}; range requests not supported.`), this.abortController?.abort(), this.atomicSetStreaming(false), this.streamError = v3, v3;
49415
49415
  }
49416
49416
  if (b2 = 0, !k2.ok && 206 !== k2.status) {
49417
49417
  if (k2.status >= 400 && k2.status < 500) {
49418
49418
  if (416 === k2.status) {
49419
- r.warn(H, "Range not satisfiable, assuming EOF"), this.atomicSetStreaming(false);
49419
+ r.warn(c, "Range not satisfiable, assuming EOF"), this.atomicSetStreaming(false);
49420
49420
  break;
49421
49421
  }
49422
49422
  throw new Error(`HTTP ${k2.status} (Fatal)`);
@@ -49441,11 +49441,11 @@ class HttpSource {
49441
49441
  }
49442
49442
  if (e2 - i2 > 1048576) {
49443
49443
  const A5 = (Date.now() - s2) / 1e3, v4 = A5 > 0 ? e2 / 1024 / 1024 / A5 : 0;
49444
- r.debug(H, `Stream progress: ${(e2 / 1024 / 1024).toFixed(2)} MB read @ ${v4.toFixed(2)} MB/s`), i2 = e2;
49444
+ r.debug(c, `Stream progress: ${(e2 / 1024 / 1024).toFixed(2)} MB read @ ${v4.toFixed(2)} MB/s`), i2 = e2;
49445
49445
  }
49446
49446
  let b3 = this.atomicGetWritePos();
49447
49447
  if (!(b3 + v3.length <= f2.length)) {
49448
- r.debug(H, "Buffer full, stopping stream"), this.atomicSetStreaming(false);
49448
+ r.debug(c, "Buffer full, stopping stream"), this.atomicSetStreaming(false);
49449
49449
  break;
49450
49450
  }
49451
49451
  {
@@ -49458,7 +49458,7 @@ class HttpSource {
49458
49458
  await new Promise((A6) => setTimeout(A6, 1));
49459
49459
  }
49460
49460
  if (!A5) {
49461
- r.error(H, "Failed to acquire lock for writing"), this.atomicSetStreaming(false);
49461
+ r.error(c, "Failed to acquire lock for writing"), this.atomicSetStreaming(false);
49462
49462
  break;
49463
49463
  }
49464
49464
  {
@@ -49473,16 +49473,16 @@ class HttpSource {
49473
49473
  if (b4 > 0.25 * this.bufferSize && this.size > 0 && j4 < this.size) {
49474
49474
  const j5 = Math.floor(b4);
49475
49475
  if (j5 > 0 && A6 > j5) {
49476
- f2.copyWithin(0, j5, A6), this.atomicSetBufferStart(v4 + j5), this.atomicSetWritePos(A6 - j5), E2 = v4 + j5, this.unlock(), r.debug(H, `Buffer compacted: reclaimed ${(j5 / 1024 / 1024).toFixed(1)}MB`);
49476
+ f2.copyWithin(0, j5, A6), this.atomicSetBufferStart(v4 + j5), this.atomicSetWritePos(A6 - j5), E2 = v4 + j5, this.unlock(), r.debug(c, `Buffer compacted: reclaimed ${(j5 / 1024 / 1024).toFixed(1)}MB`);
49477
49477
  break;
49478
49478
  }
49479
49479
  }
49480
- this.unlock(), r.debug(H, `Downloaded ${(n3 / 1024 / 1024).toFixed(1)}MB (${l3 ? "limit reached" : "buffer full"}), stopping stream`), this.atomicSetStreaming(false);
49480
+ this.unlock(), r.debug(c, `Downloaded ${(n3 / 1024 / 1024).toFixed(1)}MB (${l3 ? "limit reached" : "buffer full"}), stopping stream`), this.atomicSetStreaming(false);
49481
49481
  break;
49482
49482
  }
49483
49483
  if (this.unlock(), this.size > 0 && j4 >= this.size) {
49484
49484
  const A7 = this.atomicGetBufferStart();
49485
- 0 === A7 && this.bufferSize >= this.size && (this.fullyBuffered = true, r.info(H, `Entire file cached in memory (${(this.size / 1024 / 1024).toFixed(1)}MB)`)), r.debug(H, `Reached EOF (bufferStart=${A7}, bufferEnd=${j4}), stopping stream`), this.atomicSetStreaming(false);
49485
+ 0 === A7 && this.bufferSize >= this.size && (this.fullyBuffered = true, r.info(c, `Entire file cached in memory (${(this.size / 1024 / 1024).toFixed(1)}MB)`)), r.debug(c, `Reached EOF (bufferStart=${A7}, bufferEnd=${j4}), stopping stream`), this.atomicSetStreaming(false);
49486
49486
  break;
49487
49487
  }
49488
49488
  }
@@ -49501,32 +49501,32 @@ class HttpSource {
49501
49501
  else {
49502
49502
  if (t2++, t2 >= 3) {
49503
49503
  const A4 = new Error("Failed to fetch video resource. Check your connection or CORS settings.");
49504
- throw r.error(H, `CORS error accessing ${this.url} (${t2} consecutive failures while online)`), this.atomicSetStreaming(false), this.streamError = A4, A4;
49504
+ throw r.error(c, `CORS error accessing ${this.url} (${t2} consecutive failures while online)`), this.atomicSetStreaming(false), this.streamError = A4, A4;
49505
49505
  }
49506
- r.warn(H, `Fetch failed while online (${t2}/3), may be transient network issue`);
49506
+ r.warn(c, `Fetch failed while online (${t2}/3), may be transient network issue`);
49507
49507
  }
49508
- if (A3.message && A3.message.includes("does not support range requests")) throw r.error(H, "Range requests not supported, cannot stream this URL"), this.atomicSetStreaming(false), A3;
49508
+ if (A3.message && A3.message.includes("does not support range requests")) throw r.error(c, "Range requests not supported, cannot stream this URL"), this.atomicSetStreaming(false), A3;
49509
49509
  const f2 = A3?.message || "";
49510
49510
  if (f2.includes("(Fatal)")) {
49511
- r.error(H, `Fatal HTTP error, not retrying: ${f2}`), this.atomicSetStreaming(false), this.streamError = A3 instanceof Error ? A3 : new Error(f2);
49511
+ r.error(c, `Fatal HTTP error, not retrying: ${f2}`), this.atomicSetStreaming(false), this.streamError = A3 instanceof Error ? A3 : new Error(f2);
49512
49512
  break;
49513
49513
  }
49514
- r.warn(H, "Stream error, retrying...", A3);
49514
+ r.warn(c, "Stream error, retrying...", A3);
49515
49515
  try {
49516
49516
  this.reader && await this.reader.cancel();
49517
49517
  } catch {
49518
49518
  }
49519
49519
  if (this.reader = null, "undefined" != typeof self && self.navigator && !self.navigator.onLine) {
49520
- r.warn(H, "Network offline, waiting for connection...");
49520
+ r.warn(c, "Network offline, waiting for connection...");
49521
49521
  const A4 = this.abortController?.signal;
49522
49522
  if (await new Promise((v3) => {
49523
49523
  let j4 = false;
49524
49524
  const b4 = () => {
49525
49525
  j4 || (j4 = true, clearTimeout(t3), "undefined" != typeof self && self.removeEventListener("online", E4), A4?.removeEventListener("abort", f3), v3());
49526
49526
  }, t3 = setTimeout(() => {
49527
- r.warn(H, "Offline wait timeout, retrying anyway..."), b4();
49527
+ r.warn(c, "Offline wait timeout, retrying anyway..."), b4();
49528
49528
  }, 3e4), E4 = () => {
49529
- r.info(H, "Network online, resuming..."), b4();
49529
+ r.info(c, "Network online, resuming..."), b4();
49530
49530
  }, f3 = () => b4();
49531
49531
  "undefined" != typeof self && self.addEventListener("online", E4), A4?.addEventListener("abort", f3);
49532
49532
  }), !this.atomicIsStreaming()) break;
@@ -49534,7 +49534,7 @@ class HttpSource {
49534
49534
  continue;
49535
49535
  }
49536
49536
  if (v2++, v2 > 10) {
49537
- r.error(H, "Max retries (10) reached, giving up."), this.atomicSetStreaming(false), this.streamError = A3 instanceof Error ? A3 : new Error("string" == typeof A3 ? A3 : "Stream failed after maximum retries");
49537
+ r.error(c, "Max retries (10) reached, giving up."), this.atomicSetStreaming(false), this.streamError = A3 instanceof Error ? A3 : new Error("string" == typeof A3 ? A3 : "Stream failed after maximum retries");
49538
49538
  break;
49539
49539
  }
49540
49540
  const n2 = Math.min(1e3 * Math.pow(1.5, v2), 1e4), F2 = this.abortController?.signal;
@@ -49543,7 +49543,7 @@ class HttpSource {
49543
49543
  const b4 = () => {
49544
49544
  j4 || (j4 = true, clearTimeout(E4), "undefined" != typeof self && self.removeEventListener("online", f3), F2?.removeEventListener("abort", l2), A4());
49545
49545
  }, E4 = setTimeout(b4, n2), f3 = () => {
49546
- r.info(H, "Online event during backoff — retrying immediately"), v2 = 0, t2 = 0, b4();
49546
+ r.info(c, "Online event during backoff — retrying immediately"), v2 = 0, t2 = 0, b4();
49547
49547
  }, l2 = () => b4();
49548
49548
  "undefined" != typeof self && self.addEventListener && self.addEventListener("online", f3), F2?.addEventListener("abort", l2);
49549
49549
  });
@@ -49562,9 +49562,9 @@ class HttpSource {
49562
49562
  this.resizeBuffer(this.size), this.useSharedBuffer && this.headerView && Atomics.store(this.headerView, 5, A3);
49563
49563
  }
49564
49564
  const v2 = this.getBuffer(), j2 = this.size > 0 && this.bufferSize >= this.size;
49565
- if (j2) r.info(H, `Caching entire ${(this.size / 1048576).toFixed(1)}MB file in memory (no Range support).`);
49565
+ if (j2) r.info(c, `Caching entire ${(this.size / 1048576).toFixed(1)}MB file in memory (no Range support).`);
49566
49566
  else {
49567
- this.linearMode = true, r.warn(H, `Linear (non-seekable) playback: ${this.size > 0 ? (this.size / 1048576).toFixed(0) + "MB" : "unknown size"} exceeds the ${this.maxBufferSizeMB}MB cache cap or size is unknown.`);
49567
+ this.linearMode = true, r.warn(c, `Linear (non-seekable) playback: ${this.size > 0 ? (this.size / 1048576).toFixed(0) + "MB" : "unknown size"} exceeds the ${this.maxBufferSizeMB}MB cache cap or size is unknown.`);
49568
49568
  try {
49569
49569
  this.onLinearMode?.();
49570
49570
  } catch {
@@ -49580,7 +49580,7 @@ class HttpSource {
49580
49580
  r2 && 0 !== r2.length && (this.totalBytesDownloaded += r2.length, await this.writeSequential(r2, v2, j2));
49581
49581
  }
49582
49582
  } catch (A3) {
49583
- "AbortError" !== A3?.name && (this.streamError = A3 instanceof Error ? A3 : new Error(String(A3)), r.error(H, "Non-range stream failed", A3));
49583
+ "AbortError" !== A3?.name && (this.streamError = A3 instanceof Error ? A3 : new Error(String(A3)), r.error(c, "Non-range stream failed", A3));
49584
49584
  } finally {
49585
49585
  try {
49586
49586
  await b2.cancel();
@@ -49589,7 +49589,7 @@ class HttpSource {
49589
49589
  this.reader = null;
49590
49590
  }
49591
49591
  const t2 = this.atomicGetBufferStart() + this.atomicGetWritePos();
49592
- this.size <= 0 && (this.size = t2), j2 && 0 === this.atomicGetBufferStart() && this.size > 0 && t2 >= this.size && (this.fullyBuffered = true, r.info(H, `Entire file cached (${(this.size / 1048576).toFixed(1)}MB) — full random access.`)), this.atomicSetStreaming(false);
49592
+ this.size <= 0 && (this.size = t2), j2 && 0 === this.atomicGetBufferStart() && this.size > 0 && t2 >= this.size && (this.fullyBuffered = true, r.info(c, `Entire file cached (${(this.size / 1048576).toFixed(1)}MB) — full random access.`)), this.atomicSetStreaming(false);
49593
49593
  }
49594
49594
  async writeSequential(A2, v2, r2) {
49595
49595
  let j2 = 0;
@@ -49657,9 +49657,9 @@ class HttpSource {
49657
49657
  const v3 = Date.now();
49658
49658
  this.bufferEnd > n2 && (n2 = this.bufferEnd, F2 = v3, v3 - b2 > 0.8 * j2 && (t2 = v3 + 15e3));
49659
49659
  const l3 = v3 - F2;
49660
- if (l3 > 15e3) return r.error(H, `Stream stalled: no progress for ${(l3 / 1e3).toFixed(1)}s at ${A2}, needed ${E2}, currently ${this.bufferEnd}`), false;
49661
- if (v3 > t2) return r.error(H, `Timeout waiting for data at ${A2}, needed ${E2}, currently ${this.bufferEnd}`), false;
49662
- if (this.useSharedBuffer && this.headerView && Atomics.load(this.headerView, 5) !== f2) return r.warn(H, `Stream superseded while waiting for ${A2}`), false;
49660
+ if (l3 > 15e3) return r.error(c, `Stream stalled: no progress for ${(l3 / 1e3).toFixed(1)}s at ${A2}, needed ${E2}, currently ${this.bufferEnd}`), false;
49661
+ if (v3 > t2) return r.error(c, `Timeout waiting for data at ${A2}, needed ${E2}, currently ${this.bufferEnd}`), false;
49662
+ if (this.useSharedBuffer && this.headerView && Atomics.load(this.headerView, 5) !== f2) return r.warn(c, `Stream superseded while waiting for ${A2}`), false;
49663
49663
  this.useSharedBuffer && this.headerView ? await new Promise((A3) => setTimeout(A3, 2)) : await new Promise((A3) => setTimeout(A3, 10));
49664
49664
  }
49665
49665
  const l2 = this.bufferEnd >= E2;
@@ -49667,24 +49667,24 @@ class HttpSource {
49667
49667
  if (!l2 && !this.atomicIsStreaming()) {
49668
49668
  if (this.size > 0 && this.bufferEnd >= this.size) return true;
49669
49669
  if (this.bufferEnd >= E2) return true;
49670
- r.warn(H, `Stream ended before reaching needed offset ${E2} (current end: ${this.bufferEnd})`);
49670
+ r.warn(c, `Stream ended before reaching needed offset ${E2} (current end: ${this.bufferEnd})`);
49671
49671
  }
49672
49672
  return l2;
49673
49673
  }
49674
49674
  async read(A2, v2) {
49675
49675
  const j2 = this.peekMetadata(A2, v2);
49676
- if (j2) return this.position = A2 + v2, r.debug(H, "Read: served from metadata LRU"), j2.buffer;
49676
+ if (j2) return this.position = A2 + v2, r.debug(c, "Read: served from metadata LRU"), j2.buffer;
49677
49677
  const b2 = await this._readInternal(A2, v2);
49678
49678
  return b2.byteLength > 0 && b2.byteLength <= m && this.cacheMetadataRead(A2, new Uint8Array(b2)), b2;
49679
49679
  }
49680
49680
  async _readInternal(A2, v2) {
49681
- if (r.debug(H, `Read: offset=${A2}, length=${v2}, bufferStart=${this.atomicGetBufferStart()}, bufferEnd=${this.bufferEnd}, streaming=${this.atomicIsStreaming()}`), this.size > 0 && A2 >= this.size) return r.debug(H, "Read: returning empty (EOF)"), new ArrayBuffer(0);
49682
- if (this.fullyBuffered && A2 >= this.atomicGetBufferStart() && A2 < this.bufferEnd) return this.consecutiveForceRestarts = 0, r.debug(H, "Read: served from full-file cache"), this.readFromBuffer(A2, v2);
49681
+ if (r.debug(c, `Read: offset=${A2}, length=${v2}, bufferStart=${this.atomicGetBufferStart()}, bufferEnd=${this.bufferEnd}, streaming=${this.atomicIsStreaming()}`), this.size > 0 && A2 >= this.size) return r.debug(c, "Read: returning empty (EOF)"), new ArrayBuffer(0);
49682
+ if (this.fullyBuffered && A2 >= this.atomicGetBufferStart() && A2 < this.bufferEnd) return this.consecutiveForceRestarts = 0, r.debug(c, "Read: served from full-file cache"), this.readFromBuffer(A2, v2);
49683
49683
  if (this.headBuffer && A2 + v2 <= this.headBuffer.length) {
49684
49684
  const j3 = new Uint8Array(v2);
49685
- return j3.set(this.headBuffer.subarray(A2, A2 + v2)), this.position = A2 + v2, r.debug(H, "Read: served from head cache"), j3.buffer;
49685
+ return j3.set(this.headBuffer.subarray(A2, A2 + v2)), this.position = A2 + v2, r.debug(c, "Read: served from head cache"), j3.buffer;
49686
49686
  }
49687
- if (this.isInBuffer(A2, v2)) return this.consecutiveForceRestarts = 0, r.debug(H, "Read: serving from buffer"), this.readFromBuffer(A2, v2);
49687
+ if (this.isInBuffer(A2, v2)) return this.consecutiveForceRestarts = 0, r.debug(c, "Read: serving from buffer"), this.readFromBuffer(A2, v2);
49688
49688
  if (this.rangeUnsupported) {
49689
49689
  if (A2 < this.atomicGetBufferStart()) throw new Error("Server does not support range requests.");
49690
49690
  if (this.linearMode && A2 + v2 > this.atomicGetBufferStart() + this.bufferSize) throw new Error("Server does not support range requests.");
@@ -49694,20 +49694,20 @@ class HttpSource {
49694
49694
  throw new Error("Server does not support range requests.");
49695
49695
  }
49696
49696
  const j2 = this.atomicGetBufferStart(), b2 = A2 - this.bufferEnd, t2 = 2097152, E2 = this.atomicIsStreaming() && A2 >= j2 && A2 < j2 + this.bufferSize && b2 <= t2;
49697
- if (r.debug(H, `Read: isCoveredByStream=${E2}, gap=${(b2 / 1024).toFixed(0)}KB`), E2) {
49698
- r.debug(H, "Read: waiting for data from active stream...");
49697
+ if (r.debug(c, `Read: isCoveredByStream=${E2}, gap=${(b2 / 1024).toFixed(0)}KB`), E2) {
49698
+ r.debug(c, "Read: waiting for data from active stream...");
49699
49699
  const j3 = await this.waitForData(A2, v2);
49700
- if (r.debug(H, `Read: waitForData returned ${j3}`), j3) return this.consecutiveForceRestarts = 0, this.readFromBuffer(A2, v2);
49700
+ if (r.debug(c, `Read: waitForData returned ${j3}`), j3) return this.consecutiveForceRestarts = 0, this.readFromBuffer(A2, v2);
49701
49701
  if (this.atomicIsStreaming()) {
49702
49702
  if (this.isInBuffer(A2, v2)) return this.readFromBuffer(A2, v2);
49703
49703
  const j4 = Date.now();
49704
- if (j4 - this.lastForceRestartTime > 5e3 && (this.consecutiveForceRestarts = 0), this.consecutiveForceRestarts >= this.MAX_FORCE_RESTARTS) throw r.error(H, `Too many consecutive force restarts (${this.consecutiveForceRestarts}), giving up.`), new Error(`Stream failed after ${this.consecutiveForceRestarts} restart attempts`);
49704
+ if (j4 - this.lastForceRestartTime > 5e3 && (this.consecutiveForceRestarts = 0), this.consecutiveForceRestarts >= this.MAX_FORCE_RESTARTS) throw r.error(c, `Too many consecutive force restarts (${this.consecutiveForceRestarts}), giving up.`), new Error(`Stream failed after ${this.consecutiveForceRestarts} restart attempts`);
49705
49705
  const b3 = Math.min(100 * Math.pow(2, this.consecutiveForceRestarts), 500);
49706
- r.warn(H, `Read timeout for ${A2} but stream is active. Force restarting after ${b3}ms (attempt ${this.consecutiveForceRestarts + 1}/${this.MAX_FORCE_RESTARTS}).`), await new Promise((A3) => setTimeout(A3, b3)), this.consecutiveForceRestarts++, this.lastForceRestartTime = j4;
49706
+ r.warn(c, `Read timeout for ${A2} but stream is active. Force restarting after ${b3}ms (attempt ${this.consecutiveForceRestarts + 1}/${this.MAX_FORCE_RESTARTS}).`), await new Promise((A3) => setTimeout(A3, b3)), this.consecutiveForceRestarts++, this.lastForceRestartTime = j4;
49707
49707
  }
49708
49708
  }
49709
49709
  if (this.size > 0 && this.bufferSize >= this.size && this.atomicIsStreaming() && b2 > t2) {
49710
- r.info(H, `Read: one-off range fetch for offset=${A2}, length=${v2} (gap=${(b2 / 1024).toFixed(0)}KB, main stream continues)`);
49710
+ r.info(c, `Read: one-off range fetch for offset=${A2}, length=${v2} (gap=${(b2 / 1024).toFixed(0)}KB, main stream continues)`);
49711
49711
  try {
49712
49712
  const r2 = Math.min(A2 + v2 - 1, this.size - 1) - A2 + 1, j3 = await fetch(this.url, { headers: await this.buildRequestHeaders({ offset: A2, length: r2 }) });
49713
49713
  if (j3.ok || 206 === j3.status) {
@@ -49717,12 +49717,12 @@ class HttpSource {
49717
49717
  return E3.set(r3), this.position = A2 + r3.length, this.consecutiveForceRestarts = 0, E3.buffer;
49718
49718
  }
49719
49719
  } catch (A3) {
49720
- r.warn(H, "One-off range fetch failed, falling back to stream restart", A3);
49720
+ r.warn(c, "One-off range fetch failed, falling back to stream restart", A3);
49721
49721
  }
49722
49722
  }
49723
- r.debug(H, `Read: starting new stream from ${A2}`), await this.startStream(A2), r.debug(H, "Read: waiting for data...");
49723
+ r.debug(c, `Read: starting new stream from ${A2}`), await this.startStream(A2), r.debug(c, "Read: waiting for data...");
49724
49724
  const f2 = await this.waitForData(A2, v2);
49725
- if (r.debug(H, `Read: waitForData returned ${f2}`), !f2) throw new Error(`Timeout at ${A2}`);
49725
+ if (r.debug(c, `Read: waitForData returned ${f2}`), !f2) throw new Error(`Timeout at ${A2}`);
49726
49726
  return this.consecutiveForceRestarts = 0, this.readFromBuffer(A2, v2);
49727
49727
  }
49728
49728
  readFromBuffer(A2, v2) {
@@ -49739,7 +49739,7 @@ class HttpSource {
49739
49739
  return this.sharedBuffer;
49740
49740
  }
49741
49741
  close() {
49742
- this.stopStream(), r.debug(H, "Source closed");
49742
+ this.stopStream(), r.debug(c, "Source closed");
49743
49743
  }
49744
49744
  getKey() {
49745
49745
  return this.url;