Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A2DP stream stops sending data after 15 minutes 51 seconds #461

Closed
ftab opened this issue Apr 2, 2024 · 0 comments
Closed

A2DP stream stops sending data after 15 minutes 51 seconds #461

ftab opened this issue Apr 2, 2024 · 0 comments

Comments

@ftab
Copy link

ftab commented Apr 2, 2024

Try modifying the sbc read function in run_a2dp_source.py like so:

            async def read(byte_count):
                return sbc_file.read(byte_count)

->

            async def read(byte_count):
                data = sbc_file.read(byte_count)
                if len(data) < byte_count:
                    sbc_file.seek(0)
                    data += sbc_file.read(byte_count-len(data))
                return data

This gives a very rudimentary neverending loop. I've found that it quits sending data after 15 minutes 51 seconds (without a stream "suspend") and stopping the stream and starting again does not work:

On attempting to stop:

Traceback (most recent call last):
  File "/home/pi/MrData/mrdata/lib/python3.11/site-packages/qasync/__init__.py", line 780, in _error_handler
    task.result()
  File "/home/pi/MrData/py/BtTools.py", line 412, in stopTestAudio
    await self.audio_stream.stop()
  File "/home/pi/MrData/mrdata/lib/python3.11/site-packages/bumble/avdtp.py", line 1849, in stop
    await self.local_endpoint.stop()
  File "/home/pi/MrData/mrdata/lib/python3.11/site-packages/bumble/avdtp.py", line 2197, in stop
    return await self.packet_pump.stop()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pi/MrData/mrdata/lib/python3.11/site-packages/bumble/avdtp.py", line 411, in stop
    await self.pump_task
  File "/home/pi/MrData/mrdata/lib/python3.11/site-packages/bumble/avdtp.py", line 397, in pump_packets
    rtp_channel.send_pdu(bytes(packet))
                         ^^^^^^^^^^^^^
  File "/home/pi/MrData/mrdata/lib/python3.11/site-packages/bumble/avdtp.py", line 344, in __bytes__
    ) + struct.pack('>HII', self.sequence_number, self.timestamp, self.ssrc)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
struct.error: 'H' format requires 0 <= number <= 65535

On attempting to start again:

Traceback (most recent call last):
  File "/home/pi/MrData/mrdata/lib/python3.11/site-packages/qasync/__init__.py", line 780, in _error_handler
    task.result()
  File "/home/pi/MrData/py/BtTools.py", line 406, in playTestAudio
    await self.audio_stream.start()
  File "/home/pi/MrData/mrdata/lib/python3.11/site-packages/bumble/avdtp.py", line 1834, in start
    raise InvalidStateError('current state is not OPEN')
bumble.core.InvalidStateError: current state is not OPEN

It seems to not currently be possible to stream long-term without tearing down the stream and reconnecting after 15 minutes and 51 seconds.

barbibulle added a commit that referenced this issue Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant