summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTORS1
-rw-r--r--HISTORY2
-rw-r--r--server/connection.c45
-rw-r--r--server/connection.h4
4 files changed, 27 insertions, 25 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index af23429..a44d75c 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -180,3 +180,4 @@ Michal Novotny
wtor
for reporting that a client may interrupt replaying on FF cards
+ for helping to debug channel switch issues on FF cards
diff --git a/HISTORY b/HISTORY
index c57f74e..c3c0a84 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,6 +1,8 @@
VDR Plugin 'streamdev' Revision History
---------------------------------------
+- fixed the code deciding if a device is in use for live TV or not. It did
+ not work as expected for FF cards (reported by wtor)
- increased client side timeout for TUNE command
- more dsyslog messages to help troubleshouting channel switch issues
- improved the channel switch code trying to move live TV to different card
diff --git a/server/connection.c b/server/connection.c
index de00d90..824ba97 100644
--- a/server/connection.c
+++ b/server/connection.c
@@ -285,25 +285,26 @@ cDevice* cServerConnection::CheckDevice(const cChannel *Channel, int Priority, b
return d;
}
-cDevice *cServerConnection::GetDevice(const cChannel *Channel, int Priority)
+bool cServerConnection::UsedByLiveTV(cDevice *device)
{
- const cChannel *current = Channels.GetByNumber(cDevice::CurrentChannel());
+ return device == cTransferControl::ReceiverDevice() ||
+ (device->IsPrimaryDevice() && device->HasDecoder() && !device->Replaying());
+}
+cDevice *cServerConnection::GetDevice(const cChannel *Channel, int Priority)
+{
// turn off the streams of this connection
Detach();
// This call may detach receivers of the device it returns
cDevice *device = cDevice::GetDevice(Channel, Priority, false);
- if (device && device == cDevice::ActualDevice()
- && (!device->IsPrimaryDevice() || !device->Replaying())
- && !cSuspendCtl::IsActive()
- && current != NULL
- && !TRANSPONDER(Channel, current)) {
+ if (device && !device->IsTunedToTransponder(Channel)
+ && UsedByLiveTV(device)) {
// now we would have to switch away live tv...let's see if live tv
// can be handled by another device
#if VDRVERSNUM >= 10516
cDevice::SetAvoidDevice(device);
- if (!Channels.SwitchTo(current->Number())) {
+ if (!Channels.SwitchTo(cDevice::CurrentChannel())) {
if (StreamdevServerSetup.SuspendMode == smAlways) {
Channels.SwitchTo(Channel->Number());
Skins.QueueMessage(mtInfo, tr("Streaming active"));
@@ -314,7 +315,8 @@ cDevice *cServerConnection::GetDevice(const cChannel *Channel, int Priority)
}
}
#else
- cDevice *newdev = CheckDevice(current, 0, true, device);
+ const cChannel *current = Channels.GetByNumber(cDevice::CurrentChannel());
+ cDevice *newdev = current ? CheckDevice(current, 0, true, device) : NULL;
if (newdev) {
dsyslog("streamdev: GetDevice: Trying to move live TV to device %d", newdev->CardIndex());
newdev->SwitchChannel(current, true);
@@ -340,29 +342,22 @@ cDevice *cServerConnection::GetDevice(const cChannel *Channel, int Priority)
bool cServerConnection::ProvidesChannel(const cChannel *Channel, int Priority)
{
- const cChannel *current = Channels.GetByNumber(cDevice::CurrentChannel());
-
cDevice *device = CheckDevice(Channel, Priority, false);
- if (!device || (device == cDevice::ActualDevice()
- && (!device->IsPrimaryDevice() || !device->Replaying())
- && !cSuspendCtl::IsActive()
- && StreamdevServerSetup.SuspendMode != smAlways
- && current != NULL
- && !TRANSPONDER(Channel, current))) {
- // mustn't switch actual device
+ if (!device || (StreamdevServerSetup.SuspendMode != smAlways
+ && !device->IsTunedToTransponder(Channel)
+ && UsedByLiveTV(device))) {
+ // no device available or the device is in use for live TV and suspend mode doesn't allow us to switch it:
// maybe a device would be free if THIS connection did turn off its streams?
Detach();
device = CheckDevice(Channel, Priority, false);
Attach();
- if (device && device == cDevice::ActualDevice()
- && (!device->IsPrimaryDevice() || !device->Replaying())
- && !cSuspendCtl::IsActive()
- && StreamdevServerSetup.SuspendMode != smAlways
- && current != NULL
- && !TRANSPONDER(Channel, current)) {
+ if (device && StreamdevServerSetup.SuspendMode != smAlways
+ && !device->IsTunedToTransponder(Channel)
+ && UsedByLiveTV(device)) {
// now we would have to switch away live tv...let's see if live tv
// can be handled by another device
- cDevice *newdev = CheckDevice(current, 0, true, device);
+ const cChannel *current = Channels.GetByNumber(cDevice::CurrentChannel());
+ cDevice *newdev = current ? CheckDevice(current, 0, true, device) : NULL;
if (newdev) {
dsyslog("streamdev: Providing channel %d (%s) at priority %d requires moving live TV to device %d (PrimaryDevice=%d, ActualDevice=%d)", Channel->Number(), Channel->Name(), Priority, newdev->CardIndex(), cDevice::PrimaryDevice()->CardIndex(), cDevice::ActualDevice()->CardIndex());
}
diff --git a/server/connection.h b/server/connection.h
index 22301b1..01a070c 100644
--- a/server/connection.h
+++ b/server/connection.h
@@ -40,6 +40,10 @@ private:
detaching this connection's receivers. */
cDevice *CheckDevice(const cChannel *Channel, int Priority, bool LiveView, const cDevice *AvoidDevice = NULL);
+ /* Test if device is in use as the transfer mode receiver device
+ or a FF card, displaying live TV from internal tuner */
+ static bool UsedByLiveTV(cDevice *device);
+
protected:
/* Will be called when a command terminated by a newline has been
received */