mirror of
https://github.com/acgnhiki/blrec.git
synced 2025-01-14 20:30:08 +08:00
refactor: workaround for negative timestamp
This commit is contained in:
parent
e546b47e29
commit
e5277510c2
@ -28,6 +28,7 @@ class ExceptionHandler(AsyncCooperationMixin):
|
||||
scheduler: Optional[abc.SchedulerBase] = None,
|
||||
) -> abc.DisposableBase:
|
||||
def on_error(exc: Exception) -> None:
|
||||
logger.exception(repr(exc))
|
||||
self._submit_exception(exc)
|
||||
try:
|
||||
raise exc
|
||||
|
@ -197,6 +197,9 @@ class FlvDumper:
|
||||
self._writer.write_ui32(size)
|
||||
|
||||
def dump_tag(self, tag: FlvTag) -> None:
|
||||
if tag.timestamp < 0:
|
||||
raise FlvDataError(f'Incorrect timestamp: {tag.timestamp}', tag)
|
||||
|
||||
self.dump_flv_tag_header(tag)
|
||||
|
||||
if tag.is_audio_tag():
|
||||
|
@ -90,9 +90,6 @@ class Dumper:
|
||||
self._timestamp_updates.on_next(0)
|
||||
else:
|
||||
if self._flv_writer is not None:
|
||||
# XXX: negative timestamp will cause
|
||||
# `struct.error: ubyte format requires 0 <= number <= 255`
|
||||
assert item.timestamp >= 0, item
|
||||
size = self._flv_writer.write_tag(item)
|
||||
self._size_updates.on_next(size)
|
||||
self._timestamp_updates.on_next(item.timestamp)
|
||||
|
Loading…
Reference in New Issue
Block a user