pylibsrtp icon indicating copy to clipboard operation
pylibsrtp copied to clipboard

pylibsrtp.Error: couldn't initialize

Open bernardolansing opened this issue 2 years ago • 0 comments

I am trying to run a video transmission from a Raspberry Pi using aiortc, but recently I started to receive this weird error:

ERROR:asyncio:Task exception was never retrieved
future: <Task finished name='Task-17' coro=<RTCPeerConnection.__connect() done, defined at /home/proto003/.pyenv/versions/3.9.16/lib/python3.9/site-packages/aiortc/rtcpeerconnection.py:1000> exception=Error("couldn't initialize")>
Traceback (most recent call last):
  File "/home/proto003/.pyenv/versions/3.9.16/lib/python3.9/site-packages/aiortc/rtcpeerconnection.py", line 1010, in __connect
    await dtlsTransport.start(self.__remoteDtls[transceiver])
  File "/home/proto003/.pyenv/versions/3.9.16/lib/python3.9/site-packages/aiortc/rtcdtlstransport.py", line 413, in start
    self._rx_srtp = Session(rx_policy)
  File "/home/proto003/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pylibsrtp/__init__.py", line 202, in __init__
    _srtp_assert(lib.srtp_create(srtp, _policy))
  File "/home/proto003/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pylibsrtp/__init__.py", line 55, in _srtp_assert
    raise Error(ERRORS[rc])
pylibsrtp.Error: couldn't initialize

As i discussed here, this couldn't come from a code error, it must be something in the system that broke in the last few months. I believe the easiest way to reproduce this bug is with the aiortc webcam example.

A note that I forgot to mention in the other issue is that the ice gathering state checks as complete, the connection state stays stuck in "connecting" and the other end of the connection displays a dark screen. I tested with pylibsrtp built from source and pre-built from the official RPi wheels repository, with the same result.

This is the function that fails:

def _srtp_assert(rc):
    if rc != lib.srtp_err_status_ok:
        raise Error(ERRORS[rc])

I've added a print('rc:', rc) and this was the outcome:

rc: 0
rc: 0
rc: 5

I hope this information is enough to track whatever is going wrong.

bernardolansing avatar Oct 27 '23 11:10 bernardolansing