[linux-dvb] [patch] fix two minor issues in dvb_core

Peter Beutner p.beutner at gmx.net
Tue Jun 7 02:15:51 CEST 2005


Johannes Stezenbach schrieb:
>>>>In dvb_dmxdev_filter_start if we go out because of an error, release 
>>>>previously allocated demux_feed.
>>>
>>>This is a bit subtle. The feed is released in dvb_demux_release() (when
>>>the device is closed). What was the problem you were trying to fix with
>>>this patch?
>>
>>The problem is if you change the pid filter without closing the demux 
>>device. For example when changing the channel. Consider the following 
>>sequence:
>>tune();
>>ioctl(DMX_SET_PES_FILTER);
>>ioctl(DMX_START);
>>...
>>ioctl(DMX_STOP);
>>tune();
>>ioctl(DMX_SET_PES_FILTER);
>>ioctl(DMX_START);
>>...
>>(xine does it this way for example)
>>
>>As the status of the filter isn't set to DMXDEV_STATE_GO if an error 
>>occurs in dvb_dmx_filter_start, it wont be released in 
>>dvb_dmx_filter_stop. Because the number of filters is limited, it will 
>>run out of filters after zapping through a few channels
> 
> 
> Hm, it looks like you are right. The code is just too confusing :-(
> 
> E.g dmx_ts_feed_set() calls dvb_demux_feed_add(), but since theres
> no such thing as dmx_ts_feed_unset(), the corresponding call
> to dvb_demux_feed_del() is part of dvbdmx_release_ts_feed().

> 
> What drivers dod you test this with?
I came across this problem when I played around with the ttusb_dec
driver. When doing some cleanups I changed the return values in the
driver->start_feed() callback(ttusb_dec_start_ts_feed) to -EOPNOTSUPP 
for DMX_PES_TELETEXT/DMX_PES_OTHER filter as the driver can't handle those.
Thats the reason why ->start_filtering() failed in my case, but it could
also fail in other cases, see below.

> 
> 
>>Btw just ~5 lines above the one i changed with the patch, there is 
>>exactly the same situation. And there it is done the way as the patch 
>>does it.
> 
> 
> Two questions:
> - why does ->start_filtering() fail?
If I see this correctly ->start_filtering() calls
dmx_ts_feed_start_filtering() which fails if:
	- it don't get the demux mutex,
	- feed->state != READY
	- feed->type != TS_FEED
	- the driver callback ->start_feed() fails

> - does the same bug exist for the section filters?
I dont know for sure. I haven't really looked at the section filter code 
at all. From a first quick glance I would say probably yes( after 
->start-filtering() it checks for error but didnt release the filter), 
but honestly after looking at the code for a couple minutes i find it 
quite confusing to understand whats really going on ;)
I will probably take a closer look when I find some time.

Peter

> 
> Johannes
> 
> _______________________________________________
> linux-dvb mailing list
> linux-dvb at linuxtv.org
> http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
> 
> 




More information about the linux-dvb mailing list