停止和重新启动Live555 RTSP客户端时出现问题 [英] Problem stopping and restarting a Live555 RTSP client

查看:683
本文介绍了停止和重新启动Live555 RTSP客户端时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在应用程序中使用Live555 testRTSPClient的派生产品.我通过查找丢失的帧来检测流故障.当我检测到流已经静默"了太长时间时,我需要关闭该流并重新打开它.我知道流源仍在工作,因为其他客户端仍在接收.我目前只使用一个流,但是我留了代码来处理多个流.

当我需要重新启动流时,我调用此函数:

I am using a derivative of the Live555 testRTSPClient in an application. I am detecting stream failure by looking for missing frames. When I detect that the stream has been "silent" for too long, I need to close that stream and reopen it. I know the stream source is still working because other clients are still receiving. I am currently using only a single stream, but I left the code to handle multiple streams should I need it.

When I need to restart a stream, I call this function:

short StopAllRtspStreams(void)
{
    *env << "\n\n*** StopAllRtspStreams()\n";
    CaptureEnabled = false;
    if (initialized)
        StopExecThread();
    for (int i = 0; i < rtspClientCount; ++i)
    {
        if (rtspClients[i] != NULL)
        {
            *env << "shutting down " << *rtspClients[i] << "\n";
            shutdownStream(rtspClients[i]);
        }
        rtspClients[i] = NULL;
    }
    rtspClientCount = 0;
    // TODO anything else?
    return 0;
}



然后在重新启动流时,我调用:



Then when restarting the stream, I call:

short StartRtspStream(char * rtspURL,
                      BufferPool_t * videoPool,
                      BufferPool_t * leftPool,
                      BufferPool_t * rightPool,
                      BUFFER_CAPTURE_CALLBACK_PROC callback)
{
    if (!initialized)
        StartExecThread();
    *env << "\n\n*** StartRtspStream(" << rtspURL << ", ...)\n";
    RTSPClient* rtspClient = ourRTSPClient::createNew(*env, rtspURL, RTSP_CLIENT_VERBOSITY_LEVEL, 0, videoPool, leftPool, rightPool, callback);

    if (rtspClient == NULL)
    {
        *env << "Failed to create a RTSP client for URL \"" << rtspURL << "\": " << env->getResultMsg() << "\n";

        return 0;
    }

    rtspClient->sendDescribeCommand(continueAfterDESCRIBE); 
    rtspClients[rtspClientCount] = rtspClient;
    ++rtspClientCount;
    return 1;
}



重新启动时,事物挂起,等待套接字连接:



On the restart, the thing gets hung up waiting for the socket to connect:

*** StartRtspStream(rtsp://192.168.233.1/test, ...)
openConnection() entry
Opening connection to 192.168.233.1, port 554, socket 2148...
...connection pending (10035)



我的代码将检测到它不起作用,将其关闭,然后尝试再次启动它.一遍又一遍地.我猜我没有正确关闭某些设备.我只是不知道是什么.

有建议吗?

Mike [;-}>



My code will detect that it didn''t work, shut it down, and try to start it again. Over and over again. I''m guessing that I''m not shutting something down properly. I just can''t figure out what.

Suggestions?

Mike [;-}>

推荐答案

不幸的是,您将不会看到称为StartRtspStream方法的条件.
是什么意思我的代码将检测到它不起作用...."?
请显示您的代码....

注意,RTSP协议提供了从服务器到客户端的控制消息

RTSP服务器与客户端之间的通信中可能存在问题.
您是否正在使用任何嗅探器,例如Wireshark?
检查所有来自/来自服务器的传入/传出邮件...
Unfortunately you will not have shown the condition for which is called StartRtspStream method. What does it mean "My code will detect that it didn''t work...."?
Please show your code....

Notice , RTSP protocol provides control messages from server to client

Maybe there is a problem in communication between RTSP-server and client.
You are using any sniffer,like Wireshark,for example?
Check all incoming/outgoing messages to/from server...


这篇关于停止和重新启动Live555 RTSP客户端时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆