static STATUS latchRtspConfig()

in source/src/AppRtspSrc.c [837:859]


static STATUS latchRtspConfig(PRtspServerConfiguration pRtspServerConf)
{
    STATUS retStatus = STATUS_SUCCESS;
    PCHAR pRtspUrl, pRtspUsername, pRtspPassword;

    CHK_ERR((pRtspUrl = GETENV(APP_MEDIA_RTSP_URL)) != NULL, STATUS_MEDIA_RTSP_URL, "RTSP_URL must be set");
    STRNCPY(pRtspServerConf->url, pRtspUrl, MAX_URI_CHAR_LEN);

    pRtspUsername = GETENV(APP_MEDIA_RTSP_USERNAME);
    pRtspPassword = GETENV(APP_MEDIA_RTSP_PASSWORD);
    if (pRtspUsername != NULL && pRtspUsername[0] != '\0' && pRtspPassword != NULL && pRtspPassword[0] != '\0') {
        CHK((STRNLEN(pRtspUsername, APP_MEDIA_RTSP_USERNAME_LEN + 1) <= APP_MEDIA_RTSP_USERNAME_LEN) &&
                (STRNLEN(pRtspPassword, APP_MEDIA_RTSP_PASSWORD_LEN + 1) <= APP_MEDIA_RTSP_PASSWORD_LEN),
            STATUS_MEDIA_RTSP_CREDENTIAL);
        STRNCPY(pRtspServerConf->username, pRtspUsername, APP_MEDIA_RTSP_USERNAME_LEN);
        STRNCPY(pRtspServerConf->password, pRtspPassword, APP_MEDIA_RTSP_PASSWORD_LEN);
    } else {
        MEMSET(pRtspServerConf->username, 0, APP_MEDIA_RTSP_USERNAME_LEN);
        MEMSET(pRtspServerConf->password, 0, APP_MEDIA_RTSP_PASSWORD_LEN);
    }
CleanUp:
    return retStatus;
}