Fix RTP over TCP with a nasty hack.

This commit is contained in:
Rolf Ahrenberg 2018-10-21 20:21:33 +03:00
parent 8130a4b4e5
commit 98ecd22a27
4 changed files with 38 additions and 0 deletions

22
rtsp.c
View File

@ -206,6 +206,28 @@ bool cSatipRtsp::SetInterface(const char *bindAddrP)
return result;
}
bool cSatipRtsp::Receive(const char *uriP)
{
debug1("%s (%s) [device %d]", __PRETTY_FUNCTION__, uriP, tunerM.GetId());
bool result = false;
if (handleM && !isempty(uriP) && modeM == cSatipConfig::eTransportModeRtpOverTcp) {
long rc = 0;
cTimeMs processing(0);
CURLcode res = CURLE_OK;
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_URL, uriP);
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_STREAM_URI, uriP);
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_OPTIONS); // FIXME: this really should be CURL_RTSPREQ_RECEIVE, but getting timeout errors
SATIP_CURL_EASY_PERFORM(handleM);
result = ValidateLatestResponse(&rc);
debug5("%s (%s) Response %ld in %" PRIu64 " ms [device %d]", __PRETTY_FUNCTION__, uriP, rc, processing.Elapsed(), tunerM.GetId());
}
return result;
}
bool cSatipRtsp::Options(const char *uriP)
{
debug1("%s (%s) [device %d]", __PRETTY_FUNCTION__, uriP, tunerM.GetId());

1
rtsp.h
View File

@ -59,6 +59,7 @@ public:
cString RtspUnescapeString(const char *strP);
void Reset(void);
bool SetInterface(const char *bindAddrP);
bool Receive(const char *uriP);
bool Options(const char *uriP);
bool Setup(const char *uriP, int rtpPortP, int rtcpPortP, bool useTcpP);
bool SetSession(const char *sessionP);

14
tuner.c
View File

@ -175,6 +175,7 @@ void cSatipTuner::Action(void)
idleCheck.Set(eIdleCheckTimeoutMs);
break;
}
Receive();
break;
default:
error("Unknown tuner status %d [device %d]", currentStateM, deviceIdM);
@ -544,6 +545,19 @@ bool cSatipTuner::UpdatePids(bool forceP)
return true;
}
bool cSatipTuner::Receive(void)
{
debug16("%s tunerState=%s [device %d]", __PRETTY_FUNCTION__, TunerStateString(currentStateM), deviceIdM);
cMutexLock MutexLock(&mutexM);
if (!isempty(*streamAddrM)) {
cString uri = GetBaseUrl(*streamAddrM, streamPortM);
if (!rtspM.Receive(*uri))
return false;
}
return true;
}
bool cSatipTuner::KeepAlive(bool forceP)
{
debug16("%s (%d) tunerState=%s [device %d]", __PRETTY_FUNCTION__, forceP, TunerStateString(currentStateM), deviceIdM);

View File

@ -128,6 +128,7 @@ private:
bool Connect(void);
bool Disconnect(void);
bool Receive(void);
bool KeepAlive(bool forceP = false);
bool ReadReceptionStatus(bool forceP = false);
bool UpdatePids(bool forceP = false);