OSError: [Errno 55] No buffer space available
Closed this issue · 8 comments
not sure is anyone encounter this error
but when i try to
strm = threefive.Stream('udp://@224.2.2.4:1234')
i keep getting
OSError: [Errno 55] No buffer space available
ffplay playing good
Input #0, mpegts, from 'udp://@224.2.2.4:1234':KB sq= 0B f=0/0 Duration: N/A, start: 630.728000, bitrate: N/A Program 1 Metadata: service_name : Service01 service_provider: FFmpeg Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn Stream #0:1[0x101](und): Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 98 kb/s Stream #0:2[0x258]: Data: scte_35
System: macos Big Sur
Python : Python 3.9.13 with Anaconda
thanks
More of error message
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/*******/opt/anaconda3/envs/py36/lib/python3.9/site-packages/threefive/stream.py", line 139, in __init__ self._tsdata = reader(tsdata) File "/Users/*******/opt/anaconda3/envs/py36/lib/python3.9/site-packages/new_reader.py", line 72, in reader return _open_mcast(uri) File "/Users/xiaozhi/opt/anaconda3/envs/py36/lib/python3.9/site-packages/new_reader.py", line 142, in _open_mcast mcast_sock = _mk_mcast_sock(mcast_grp, mcast_port) File "/Users/*******/opt/anaconda3/envs/py36/lib/python3.9/site-packages/new_reader.py", line 116, in _mk_mcast_sock _udp_sock_opts(sock) File "/Users/*******/opt/anaconda3/envs/py36/lib/python3.9/site-packages/new_reader.py", line 91, in _udp_sock_opts sock.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 90000000) OSError: [Errno 55] No buffer space available
Try this:
import threefive
# start monkey patch
import new_reader
import socket
def _udp_sock_opts(sock):
# sock.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 90000000)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 7456540)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
if hasattr(socket, "SO_REUSEPORT"):
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
new_reader._udp_sock_opts = _udp_sock_opts
# end monkey patch
strm = threefive.Stream('udp://@224.2.2.4:1234')
Does it work for you?
Hi richard
thanks very much it is working nicely
the output as expect
{
"info_section": {
"table_id": "0xfc",
"section_syntax_indicator": false,
"private": false,
"sap_type": "0x3",
"sap_details": "No Sap Type",
"section_length": 42,
"protocol_version": 0,
"encrypted_packet": false,
"encryption_algorithm": 0,
"pts_adjustment_ticks": 0,
"pts_adjustment": 0.0,
"cw_index": "0x0",
"tier": "0xfff",
"splice_command_length": 15,
"splice_command_type": 5,
"descriptor_loop_length": 10,
"crc": "0x81d26ba8"
},
"command": {
"command_length": 15,
"command_type": 5,
"name": "Splice Insert",
"break_auto_return": true,
"break_duration": 4.0,
"break_duration_ticks": 360000,
"splice_event_id": 18,
"splice_event_cancel_indicator": false,
"out_of_network_indicator": true,
"program_splice_flag": true,
"duration_flag": true,
"splice_immediate_flag": true,
"unique_program_id": 0,
"avail_num": 0,
"avail_expected": 0
},
"descriptors": [
{
"tag": 0,
"descriptor_length": 8,
"name": "Avail Descriptor",
"identifier": "CUEY",
"provider_avail_id": 18
}
],
"packet_data": {
"pid": "0x258",
"program": 1,
"pcr_ticks": 1226830219,
"pcr": 13631.446878,
}
}
@richard-vd,
I appreciate your enthusiasm, however, I need you to stop.
That is not a solution. You didn't solve the problem, you just worked around it.
@cisiwen
I set the buffer gigantic like that because some people were dropping packets.
If you drop packets, the receive buffer can be increased at the OS level with sysctl.
sysctl net.inet.udp.recvspace
thanks for the deep level of explanation! i suspected could be os level issue but can't get proper fix from google search
very lucky i get the answer and solution from both you and richard
Like threefive work like a charm and thanks both you and richard so quick and prefessinal solution.
belive the issue solved, you can close the ticket!
run
pip3 install --upgrade threefive
and it should work without having to patch it.