All of lore.kernel.org
 help / color / mirror / Atom feed
* Expected behavior for S_INPUT while streaming in progress?
@ 2013-07-22 19:48 Devin Heitmueller
  2013-07-23  6:46 ` Hans Verkuil
  0 siblings, 1 reply; 2+ messages in thread
From: Devin Heitmueller @ 2013-07-22 19:48 UTC (permalink / raw)
  To: Linux Media Mailing List

Hello,

I'm doing some cleanup on the au8522 driver, and one thing I noticed
was that you are actually allowed to issue an S_INPUT while streaming
is active.  This seems like dangerous behavior, since it can result in
things like the standard and/or resolution changing while the device
is actively streaming video.

Should we be returning -EBUSY for S_INPUT if streaming is in progress?
 I see cases in drivers where we prevent S_STD from working while
streaming is in progress, but it seems like S_INPUT is a superset of
S_STD (it typically happens earlier in the setup process).

If we did do this, how badly do we think it would break existing
applications?  It could require applications to do a STREAMOFF before
setting the input (to handle the possibility that the call wasn't
issued previously when an app was done with the device), which I
suspect many applications aren't doing today.

Alternatively, we can based it on not just whether streamon was called
and instead base it on the combination of streamon having been called
and a filehandle actively doing streaming.  In this case case would
return EBUSY if both conditions were met, but if only streamon was
called but streaming wasn't actively being done by a filehandle, we
would internally call streamoff and then change the input.  This would
mean that if an application like tvtime were running, externally
toggling the input would return EBUSY.  But if nothing was actively
streaming via a /dev/videoX device then the call to set input would be
successful (after internally stopping the stream).

Devin

-- 
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Expected behavior for S_INPUT while streaming in progress?
  2013-07-22 19:48 Expected behavior for S_INPUT while streaming in progress? Devin Heitmueller
@ 2013-07-23  6:46 ` Hans Verkuil
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Verkuil @ 2013-07-23  6:46 UTC (permalink / raw)
  To: Devin Heitmueller; +Cc: Linux Media Mailing List

Hi Devin,

On 07/22/2013 09:48 PM, Devin Heitmueller wrote:
> Hello,
> 
> I'm doing some cleanup on the au8522 driver, and one thing I noticed
> was that you are actually allowed to issue an S_INPUT while streaming
> is active.  This seems like dangerous behavior, since it can result in
> things like the standard and/or resolution changing while the device
> is actively streaming video.
> 
> Should we be returning -EBUSY for S_INPUT if streaming is in progress?
>  I see cases in drivers where we prevent S_STD from working while
> streaming is in progress, but it seems like S_INPUT is a superset of
> S_STD (it typically happens earlier in the setup process).

Some drivers already return EBUSY for S_INPUT (ivtv). If the hardware
can't safely support it to switch inputs while streaming, then there
is no option but to return EBUSY.

Changing from one SDTV input to another SDTV input should not trigger
a change of standard, so that in itself should not be a cause for
blocking S_INPUT while streaming. Switching between e.g. a HDTV and
a SDTV input is a different matter: there the resolution really
changes and that should return an error while streaming.

> If we did do this, how badly do we think it would break existing
> applications?  It could require applications to do a STREAMOFF before
> setting the input (to handle the possibility that the call wasn't
> issued previously when an app was done with the device), which I
> suspect many applications aren't doing today.

Most drivers allow switching between e.g. the tuner and composite input
on the fly while streaming. Some don't like ivtv where the hardware can't
resync properly. I know there where problems with applications at the
time when I made that change in ivtv, but I haven't heard of it in a long
time, so applications may be fixed.

> Alternatively, we can based it on not just whether streamon was called
> and instead base it on the combination of streamon having been called
> and a filehandle actively doing streaming.  In this case case would
> return EBUSY if both conditions were met, but if only streamon was
> called but streaming wasn't actively being done by a filehandle, we
> would internally call streamoff and then change the input.  This would
> mean that if an application like tvtime were running, externally
> toggling the input would return EBUSY.  But if nothing was actively
> streaming via a /dev/videoX device then the call to set input would be
> successful (after internally stopping the stream).

This seems overkill. When dealing with SDTV inputs I would just
make sure that switching inputs will not change the standard, which is
a perfectly reasonable thing to do.

Regards,

	Hans

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-07-23  6:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-22 19:48 Expected behavior for S_INPUT while streaming in progress? Devin Heitmueller
2013-07-23  6:46 ` Hans Verkuil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.