mirror of
https://github.com/rofafor/vdr-plugin-satip.git
synced 2023-10-10 13:37:42 +02:00
Fixed a channel switching logic bug (Thanks to REELcoder).
This commit is contained in:
parent
a3fa5865f3
commit
826dea4ba8
2
HISTORY
2
HISTORY
@ -211,3 +211,5 @@ VDR Plugin 'satip' Revision History
|
||||
2019-XX-XX: Version 2.4.1
|
||||
|
||||
- Added an option to enable/disable frontend reuse.
|
||||
- Added a preliminary ATSC support.
|
||||
- Fixed a channel switching logic bug (Thanks to REELcoder).
|
||||
|
22
tuner.c
22
tuner.c
@ -25,6 +25,8 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP)
|
||||
rtcpM(*this),
|
||||
streamAddrM(""),
|
||||
streamParamM(""),
|
||||
lastAddrM(""),
|
||||
lastParamM(""),
|
||||
tnrParamM(""),
|
||||
streamPortM(SATIP_DEFAULT_RTSP_PORT),
|
||||
currentServerM(NULL, deviceP.GetId(), 0),
|
||||
@ -34,6 +36,7 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP)
|
||||
keepAliveM(),
|
||||
statusUpdateM(),
|
||||
pidUpdateCacheM(),
|
||||
setupTimeoutM(-1),
|
||||
sessionM(""),
|
||||
currentStateM(tsIdle),
|
||||
internalStateM(),
|
||||
@ -192,8 +195,6 @@ bool cSatipTuner::Open(void)
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
debug1("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
|
||||
RequestState(tsSet, smExternal);
|
||||
|
||||
// return always true
|
||||
return true;
|
||||
}
|
||||
@ -203,6 +204,7 @@ bool cSatipTuner::Close(void)
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
debug1("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
|
||||
if (setupTimeoutM.TimedOut())
|
||||
RequestState(tsRelease, smExternal);
|
||||
|
||||
// return always true
|
||||
@ -219,10 +221,15 @@ bool cSatipTuner::Connect(void)
|
||||
tnrParamM = "";
|
||||
// Just retune
|
||||
if (streamIdM >= 0) {
|
||||
if (!strcmp(*streamParamM, *lastParamM)) {
|
||||
debug1("%s Identical parameters [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
return true;
|
||||
}
|
||||
cString uri = cString::sprintf("%sstream=%d?%s", *connectionUri, streamIdM, *streamParamM);
|
||||
debug1("%s Retuning [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
if (rtspM.Play(*uri)) {
|
||||
keepAliveM.Set(timeoutM);
|
||||
lastParamM = streamParamM;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -240,6 +247,7 @@ bool cSatipTuner::Connect(void)
|
||||
currentServerM = nextServerM;
|
||||
nextServerM.Reset();
|
||||
}
|
||||
lastAddrM = connectionUri;
|
||||
currentServerM.Attach();
|
||||
return true;
|
||||
}
|
||||
@ -257,8 +265,8 @@ bool cSatipTuner::Disconnect(void)
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
debug1("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
|
||||
if (!isempty(*streamAddrM) && (streamIdM >= 0)) {
|
||||
cString uri = cString::sprintf("%sstream=%d", *GetBaseUrl(*streamAddrM, streamPortM), streamIdM);
|
||||
if (!isempty(*lastAddrM) && (streamIdM >= 0)) {
|
||||
cString uri = cString::sprintf("%sstream=%d", *lastAddrM, streamIdM);
|
||||
rtspM.Teardown(*uri);
|
||||
// some devices requires a teardown for TCP connection also
|
||||
rtspM.Reset();
|
||||
@ -447,7 +455,13 @@ bool cSatipTuner::SetSource(cSatipServer *serverP, const int transponderP, const
|
||||
if (nextServerM.IsQuirk(cSatipServer::eSatipQuirkForcePilot) && strstr(parameterP, "msys=dvbs2") && !strstr(parameterP, "plts="))
|
||||
streamParamM = rtspM.RtspUnescapeString(*cString::sprintf("%s&plts=on", parameterP));
|
||||
// Reconnect
|
||||
if (!isempty(*lastAddrM)) {
|
||||
cString connectionUri = GetBaseUrl(*streamAddrM, streamPortM);
|
||||
if (strcmp(*connectionUri, *lastAddrM))
|
||||
RequestState(tsRelease, smInternal);
|
||||
}
|
||||
RequestState(tsSet, smExternal);
|
||||
setupTimeoutM.Set(eSetupTimeoutMs);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
6
tuner.h
6
tuner.h
@ -88,7 +88,8 @@ private:
|
||||
eConnectTimeoutMs = 5000, // in milliseconds
|
||||
eIdleCheckTimeoutMs = 15000, // in milliseconds
|
||||
eTuningTimeoutMs = 20000, // in milliseconds
|
||||
eMinKeepAliveIntervalMs = 30000 // in milliseconds
|
||||
eMinKeepAliveIntervalMs = 30000, // in milliseconds
|
||||
eSetupTimeoutMs = 2000 // in milliseconds
|
||||
};
|
||||
enum eTunerState { tsIdle, tsRelease, tsSet, tsTuned, tsLocked };
|
||||
enum eStateMode { smInternal, smExternal };
|
||||
@ -101,6 +102,8 @@ private:
|
||||
cSatipRtcp rtcpM;
|
||||
cString streamAddrM;
|
||||
cString streamParamM;
|
||||
cString lastAddrM;
|
||||
cString lastParamM;
|
||||
cString tnrParamM;
|
||||
int streamPortM;
|
||||
cSatipTunerServer currentServerM;
|
||||
@ -110,6 +113,7 @@ private:
|
||||
cTimeMs keepAliveM;
|
||||
cTimeMs statusUpdateM;
|
||||
cTimeMs pidUpdateCacheM;
|
||||
cTimeMs setupTimeoutM;
|
||||
cString sessionM;
|
||||
eTunerState currentStateM;
|
||||
cVector<eTunerState> internalStateM;
|
||||
|
Loading…
Reference in New Issue
Block a user