Camera streams failing after 0.114 - 0.115 upgrade

these streams were working fine in 0.114 but fails with the log below in 0.115, and ideas…?

2020-09-19 09:31:55 INFO (MainThread) [homeassistant.components.camera] Setting up camera.generic
2020-09-19 09:31:55 INFO (MainThread) [homeassistant.components.camera] Setting up camera.generic
2020-09-19 09:32:08 ERROR (stream_worker) [root] Uncaught thread exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/src/homeassistant/homeassistant/components/stream/worker.py", line 48, in stream_worker
    _stream_worker_internal(hass, stream, quit_event)
  File "/usr/src/homeassistant/homeassistant/components/stream/worker.py", line 194, in _stream_worker_internal
    if not peek_first_pts():
  File "/usr/src/homeassistant/homeassistant/components/stream/worker.py", line 133, in peek_first_pts
    first_pts[packet.stream] = packet.dts - packet.duration
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
2020-09-19 09:32:08 ERROR (stream_worker) [root] Uncaught thread exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/src/homeassistant/homeassistant/components/stream/worker.py", line 48, in stream_worker
    _stream_worker_internal(hass, stream, quit_event)
  File "/usr/src/homeassistant/homeassistant/components/stream/worker.py", line 194, in _stream_worker_internal
    if not peek_first_pts():
  File "/usr/src/homeassistant/homeassistant/components/stream/worker.py", line 133, in peek_first_pts
    first_pts[packet.stream] = packet.dts - packet.duration
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
2020-09-19 09:32:18 ERROR (stream_worker) [root] Uncaught thread exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/src/homeassistant/homeassistant/components/stream/worker.py", line 48, in stream_worker
    _stream_worker_internal(hass, stream, quit_event)
  File "/usr/src/homeassistant/homeassistant/components/stream/worker.py", line 194, in _stream_worker_internal
    if not peek_first_pts():
  File "/usr/src/homeassistant/homeassistant/components/stream/worker.py", line 133, in peek_first_pts
    first_pts[packet.stream] = packet.dts - packet.duration
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
2020-09-19 09:32:18 ERROR (stream_worker) [root] Uncaught thread exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/src/homeassistant/homeassistant/components/stream/worker.py", line 48, in stream_worker
    _stream_worker_internal(hass, stream, quit_event)
  File "/usr/src/homeassistant/homeassistant/components/stream/worker.py", line 194, in _stream_worker_internal
    if not peek_first_pts():
  File "/usr/src/homeassistant/homeassistant/components/stream/worker.py", line 133, in peek_first_pts
    first_pts[packet.stream] = packet.dts - packet.duration
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'

config

camera:
- platform: generic
  name: nnn
  still_image_url: "http://n:[email protected]/cgi-bin/snapshot.cgi?channel=4"
  stream_source: "rtsp://n:[email protected]:554/cam/realmonitor?channel=4&subtype=1"
- platform: generic
  name: xxx
  still_image_url: "http://x:[email protected]/cgi-bin/snapshot.cgi?channel=1"
  stream_source: "rtsp://n:[email protected]:554/cam/realmonitor?channel=1&subtype=1"
 

For some reason it looks like your camera stream is sending occasional packets with no dts. There was already code to ignore this in the main stream worker loop, but we didn’t account for this in the new initialization section. I will post a PR to address this.

1 Like

I think Yoy did something wrong…

Having the same issue on latest version HASSIO. Are there any workaround/fix for this. It’s flooding my log file. I’m having a HikVision cam.