MCPcopy Create free account
hub / github.com/HelpFreedom/youthub / _patch_context

Method _patch_context

sabr.py:348–357  ·  view source on GitHub ↗

Rewrite the bootstrap body's player-context fields with our HD hints.

(self, body_bytes: bytes)

Source from the content-addressed store, hash-verified

346 self.template = pe.parse(self.init_body)
347
348 def _patch_context(self, body_bytes: bytes) -> bytes:
349 """Rewrite the bootstrap body's player-context fields with our HD hints."""
350 msg = pe.parse(body_bytes)
351 ctx = msg.first(1)
352 if ctx and isinstance(ctx.value, pe.Message):
353 ctx.value.set_varint(18, self.player_width)
354 ctx.value.set_varint(19, self.player_height)
355 ctx.value.set_varint(23, self.bandwidth_bps)
356 ctx.value.set_varint(59, self.max_height)
357 return pe.serialize(msg)
358
359 def _do_bootstrap(self) -> Iterable[tuple[TrackKey, int, bytes]]:
360 """Send the captured init body with HD context patched in."""

Callers 1

_do_bootstrapMethod · 0.95

Calls 2

firstMethod · 0.80
set_varintMethod · 0.80

Tested by

no test coverage detected