Skip to content

Commit

Permalink
Check response codes of RTSP requests (see #3015)
Browse files Browse the repository at this point in the history
  • Loading branch information
lminiero committed Jul 1, 2022
1 parent 7b1f8e8 commit 34d94a1
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions plugins/janus_streaming.c
Original file line number Diff line number Diff line change
Expand Up @@ -6685,8 +6685,10 @@ static int janus_streaming_rtsp_connect_to_server(janus_streaming_mountpoint *mp
if(audio_fds.fd != -1) close(audio_fds.fd);
if(audio_fds.rtcp_fd != -1) close(audio_fds.rtcp_fd);
return -5;
} else if(code != 200) {
JANUS_LOG(LOG_ERR, "Couldn't get SETUP code: %ld\n", code);
}
res = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &code);
if(code != 200) {
JANUS_LOG(LOG_ERR, "Couldn't SETUP, got error code: %ld\n", code);
g_strfreev(parts);
curl_easy_cleanup(curl);
g_free(curldata->buffer);
Expand Down Expand Up @@ -6858,8 +6860,10 @@ static int janus_streaming_rtsp_connect_to_server(janus_streaming_mountpoint *mp
if(audio_fds.fd != -1) close(audio_fds.fd);
if(audio_fds.rtcp_fd != -1) close(audio_fds.rtcp_fd);
return -6;
} else if(code != 200) {
JANUS_LOG(LOG_ERR, "Couldn't get SETUP code: %ld\n", code);
}
res = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &code);
if(code != 200) {
JANUS_LOG(LOG_ERR, "Couldn't SETUP, got error code: %ld\n", code);
g_strfreev(parts);
curl_easy_cleanup(curl);
g_free(curldata->buffer);
Expand Down Expand Up @@ -7122,6 +7126,13 @@ static int janus_streaming_rtsp_play(janus_streaming_rtp_source *source) {
janus_mutex_unlock(&source->rtsp_mutex);
return -1;
}
long code = 0;
res = curl_easy_getinfo(source->curl, CURLINFO_RESPONSE_CODE, &code);
if(code != 200) {
JANUS_LOG(LOG_ERR, "Couldn't PLAY, got error code: %ld\n", code);
janus_mutex_unlock(&source->rtsp_mutex);
return -1;
}
JANUS_LOG(LOG_VERB, "PLAY answer:%s\n", source->curldata->buffer);
janus_mutex_unlock(&source->rtsp_mutex);
return 0;
Expand Down

0 comments on commit 34d94a1

Please sign in to comment.