mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-08-14 16:38:29 +00:00
Fix DRC formats failing to download
This commit is contained in:
parent
a37f1de764
commit
993c19dc59
@ -271,6 +271,11 @@ def test_start_time_ms_invalid(self, base_args, invalid_start_time_ms):
|
|||||||
start_time_ms=invalid_start_time_ms,
|
start_time_ms=invalid_start_time_ms,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_client_abr_state_defaults(self, base_args):
|
||||||
|
processor = SabrProcessor(**base_args)
|
||||||
|
# Must be enabled to allow DRC formats to be streamed
|
||||||
|
assert processor.client_abr_state.drc_enabled is True
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
'duration_sec,tolerance_ms',
|
'duration_sec,tolerance_ms',
|
||||||
[
|
[
|
||||||
|
@ -7,3 +7,4 @@
|
|||||||
class ClientAbrState:
|
class ClientAbrState:
|
||||||
player_time_ms: protobug.Int64 | None = protobug.field(28, default=None)
|
player_time_ms: protobug.Int64 | None = protobug.field(28, default=None)
|
||||||
enabled_track_types_bitfield: protobug.Int32 | None = protobug.field(40, default=None)
|
enabled_track_types_bitfield: protobug.Int32 | None = protobug.field(40, default=None)
|
||||||
|
drc_enabled: protobug.Bool = protobug.field(46, default=False)
|
||||||
|
@ -182,7 +182,9 @@ def _initialize_cabr_state(self):
|
|||||||
self.logger.debug(f'Starting playback at: {self.start_time_ms}ms')
|
self.logger.debug(f'Starting playback at: {self.start_time_ms}ms')
|
||||||
self.client_abr_state = ClientAbrState(
|
self.client_abr_state = ClientAbrState(
|
||||||
player_time_ms=self.start_time_ms,
|
player_time_ms=self.start_time_ms,
|
||||||
enabled_track_types_bitfield=enabled_track_types_bitfield)
|
enabled_track_types_bitfield=enabled_track_types_bitfield,
|
||||||
|
drc_enabled=True, # Required to stream DRC formats
|
||||||
|
)
|
||||||
|
|
||||||
def match_format_selector(self, format_init_metadata):
|
def match_format_selector(self, format_init_metadata):
|
||||||
for format_selector in (self._video_format_selector, self._audio_format_selector, self._caption_format_selector):
|
for format_selector in (self._video_format_selector, self._audio_format_selector, self._caption_format_selector):
|
||||||
|
@ -188,7 +188,7 @@ def url(self):
|
|||||||
@url.setter
|
@url.setter
|
||||||
def url(self, url):
|
def url(self, url):
|
||||||
self.logger.debug(f'New URL: {url}')
|
self.logger.debug(f'New URL: {url}')
|
||||||
if hasattr(self, '_url') and ((bn := broadcast_id_from_url(url)) != (bc := broadcast_id_from_url(self.url))):
|
if self.processor.is_live and hasattr(self, '_url') and ((bn := broadcast_id_from_url(url)) != (bc := broadcast_id_from_url(self.url))):
|
||||||
raise SabrStreamError(f'Broadcast ID changed from {bc} to {bn}. The download will need to be restarted.')
|
raise SabrStreamError(f'Broadcast ID changed from {bc} to {bn}. The download will need to be restarted.')
|
||||||
self._url = url
|
self._url = url
|
||||||
if str_or_none(parse_qs(url).get('source', [None])[0]) == 'yt_live_broadcast':
|
if str_or_none(parse_qs(url).get('source', [None])[0]) == 'yt_live_broadcast':
|
||||||
|
Loading…
Reference in New Issue
Block a user