通过多个 IP 摄像机捕获视频数据包
我们正在开发一个 C 语言应用程序,它是简单的 RTSP/RTP 客户端,用于录制来自 Axis 多个摄像机的视频。我们为每个相机启动一个 pthread,用于建立 RTP 会话,并开始记录使用 recvfrom() 调用捕获的数据包。 单个摄像头单个 pthread 可以很好地记录一天多的时间,没有出现任何问题。
但使用更多可用摄像机(大约 25 个(即 25 个 pthreads))进行测试时,记录到文件的情况可以正常进行 15 到 20 分钟,然后记录就会停止。该应用程序仍然保持运行。一个半月以来,我们一直在尝试各种实施方案,但似乎没有任何帮助。请提供建议。
我们使用的是CentOS 5平台
We are working on a C language application which is simple RTSP/RTP client to record video from Axis a number of Cameras. We launch a pthread for each of the camera which establishes the RTP session and begin to record the packets captured using the recvfrom() call.
A single camera single pthread records fine for well over a day without issues.
But testing with more cameras available,about 25(so 25 pthreads), the recording to file goes fine for like 15 to 20 mins and then the recording just stops. The application still keeps running. Its been over a month and a half we have been trying with varied implementations but nothing seems to help. Please provide suggestions.
We are using CentOS 5 platform
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
定义“记录”这是否意味着将数据写入文件?如何控制对文件的访问?
您不能让多个线程同时尝试写入。所以阿隆的评论似乎是中肯的。您的写访问控制机制有问题。
Define "record" Does that mean write data to a file? How do you control access to the file?
You can't have several threads all trying to write at the exact same time. So the comment by Alon seems to be pertinent. Your write access control machanism has problems.
即使坚持单线程实现是可以的,为什么多线程方法会这样(大约 15 分钟后不记录)..?
even if it is alright to stick to the single threaded implementation why is the multithreaded approach behaving such a way(not recording after ~15 mins)..?