From patchwork Sun Apr 29 15:14:21 2007 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anssi Hannula X-Patchwork-Id: 12453 Received: from pne-smtpout4-sn2.hy.skanova.net ([81.228.8.154]) by www.linuxtv.org with esmtp (Exim 4.50) id 1HiB6y-0000Lg-Sp for vdr@linuxtv.org; Sun, 29 Apr 2007 17:14:53 +0200 Received: from mail.onse.fi (80.223.77.223) by pne-smtpout4-sn2.hy.skanova.net (7.2.075) id 45B62169004F6992 for vdr@linuxtv.org; Sun, 29 Apr 2007 17:14:21 +0200 Received: from gamma.onse.fi (gamma [10.0.0.7]) by mail.onse.fi (Postfix) with ESMTP id 810E550FC0D1 for ; Sun, 29 Apr 2007 18:14:20 +0300 (EEST) Message-ID: <4634B64D.2050504@gmail.com> Date: Sun, 29 Apr 2007 18:14:21 +0300 From: Anssi Hannula User-Agent: Thunderbird 2.0b2 (X11/20070313) MIME-Version: 1.0 To: VDR Mailing List Subject: Re: [vdr] [PATCH] re-use devices in transfer mode References: <46297FC1.8070104@gmail.com> <4629EB48.7050702@gmx.de> <462A1F0B.8060500@gmail.com> <46349A1F.3010807@cadsoft.de> In-Reply-To: <46349A1F.3010807@cadsoft.de> X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Apr 2007 15:14:53 -0000 Status: O X-Status: X-Keywords: X-UID: 12752 Klaus Schmidinger wrote: > On 04/21/07 16:26, Anssi Hannula wrote: >> Udo Richter wrote: >>> Anssi Hannula wrote: >>>> However, the usual "use-already-tuned-devices" check in GetDevice() only >>>> checks for device->Receiving(), which does not report transfer-moded >>>> device, resulting in the new receiver being started on second device, >>>> thus both devices being reserved for receiving data from the same >>>> transponder. >>> Without taking a deeper look into it right now, I think there was some >>> trap with detecting transfer mode in case that some streams are received >>> additionally to live mode, for example teletext with osdteletext plugin. >>> You may want to double-check this. Changes to GetDevice tend to have >>> strange side effects. >> I proposed this same patch previously, but it was suggested to instead >> of the check for transfer mode to just change the Receiving() to >> Receiving(true). I didn't see any caveats back then, so I agreed. >> Unfortunately, that resulted in problems with situations that you describe. >> >> However, this original version of the patch does explicitely check for a >> device in transfer-mode, and does not care about osdteletext receivers. >> >> What could happen is that this would match the transfer modes whose >> receiverdevice() is the primary device itself (some situations related >> to the ca or ac3, I guess), thus starting the new receiver in the >> primary device, which could cause side-effects if the card's bandwidth >> is not wide enough. However, even without this patch, when a recording >> is already taking place on the primary device, this rule matches and >> another recording could be started on the primary device. I don't know >> if we should be preventing these from happening, but if we do, I think >> we could make the rule as >> imp |= !device[i]->Receiving() && (device[i] != >> cTransferControl::ReceiverDevice() || device[i]->IsPrimaryDevice()) || >> ndr // prevents matching local-transfer-moded primary-device >> or >> imp |= !device[i]->Receiving() && device[i] != >> cTransferControl::ReceiverDevice() || device[i]->IsPrimaryDevice() || >> ndr // addidtionally prevents matching recording primary-devices > > I'm not sure about changing anything in that area in any 1.4 maintenance patch. > > If this gets changed at all, it will be in the 1.5 developer version. > So please provide a patch for that version, possibly including all the > thoughts that have come up in this thread. Attached is a patch against 1.5.2. I changed it so that primary devices in local transfer mode are not considered for re-using (I don't know the best behaviour here, just trying to minimize the effects of the patch). I.e. this patch now affects only non-primary devices: - 2 non-primary devices, one used in transfer mode on transponder A, second free - a new recording / streamdev session starts on transponder A * Before: The new recording starts on the free device. * After: The new recording starts on the already-tuned device. diff -Nurp -x '*~' vdr-1.5.2/device.c vdr-1.5.2-f/device.c --- vdr-1.5.2/device.c 2007-01-13 14:05:00.000000000 +0200 +++ vdr-1.5.2-f/device.c 2007-04-29 17:47:18.000000000 +0300 @@ -327,7 +327,7 @@ cDevice *cDevice::GetDevice(const cChann // difference, because it results in the most significant bit of the result. uint32_t imp = 0; imp <<= 1; imp |= LiveView ? !device[i]->IsPrimaryDevice() || ndr : 0; // prefer the primary device for live viewing if we don't need to detach existing receivers - imp <<= 1; imp |= !device[i]->Receiving() || ndr; // use receiving devices if we don't need to detach existing receivers + imp <<= 1; imp |= !device[i]->Receiving() && (device[i] != cTransferControl::ReceiverDevice() || device[i]->IsPrimaryDevice()) || ndr; // use receiving devices if we don't need to detach existing receivers, but avoid primary device in local transfer mode imp <<= 1; imp |= device[i]->Receiving(); // avoid devices that are receiving imp <<= 1; imp |= device[i] == cTransferControl::ReceiverDevice(); // avoid the Transfer Mode receiver device imp <<= 8; imp |= min(max(device[i]->Priority() + MAXPRIORITY, 0), 0xFF); // use the device with the lowest priority (+MAXPRIORITY to assure that values -99..99 can be used)