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,
|
scheduler: Optional[abc.SchedulerBase] = None,
|
||||||
) -> abc.DisposableBase:
|
) -> abc.DisposableBase:
|
||||||
def on_error(exc: Exception) -> None:
|
def on_error(exc: Exception) -> None:
|
||||||
|
logger.exception(repr(exc))
|
||||||
self._submit_exception(exc)
|
self._submit_exception(exc)
|
||||||
try:
|
try:
|
||||||
raise exc
|
raise exc
|
||||||
|
@ -197,6 +197,9 @@ class FlvDumper:
|
|||||||
self._writer.write_ui32(size)
|
self._writer.write_ui32(size)
|
||||||
|
|
||||||
def dump_tag(self, tag: FlvTag) -> None:
|
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)
|
self.dump_flv_tag_header(tag)
|
||||||
|
|
||||||
if tag.is_audio_tag():
|
if tag.is_audio_tag():
|
||||||
|
@ -90,9 +90,6 @@ class Dumper:
|
|||||||
self._timestamp_updates.on_next(0)
|
self._timestamp_updates.on_next(0)
|
||||||
else:
|
else:
|
||||||
if self._flv_writer is not None:
|
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)
|
size = self._flv_writer.write_tag(item)
|
||||||
self._size_updates.on_next(size)
|
self._size_updates.on_next(size)
|
||||||
self._timestamp_updates.on_next(item.timestamp)
|
self._timestamp_updates.on_next(item.timestamp)
|
||||||
|
Loading…
Reference in New Issue
Block a user