pwc
[Top] [All Lists]

[pwc] About streaming in pwc with v4l2

To:
Subject: [pwc] About streaming in pwc with v4l2
From: Andrea <>
Date: Wed, 09 Jul 2008 21:16:09 +0100
Hi,

I've been writing a few mails about the implementation of the streaming 
functions in pwc.
I am talking about the ioctls

VIDIOC_DQBUF
VIDIOC_QBUF
VIDIOC_STREAMON
VIDIOC_STREAMOFF

I think those are related to the fact that mplayer hangs at the end of a video 
played from pwc with 
v4l2.

I have not received any feedback so far, so I might say something not exact. 
Please correct me.

Usually an application should queue all buffers (QBUF) and then in a loop 
dequeue a buffer (DQBUF), 
use it, and requeue it.

A driver should only dequeue buffers that have been queued.

When STREAMOFF is called all queued buffer should be destroyed, and following 
calls to DQBUF should 
fail.

As a source of that I've read

http://lwn.net/Articles/240667/
http://www.linuxtv.org/downloads/video4linux/API/V4L2_API/spec/r8849.htm
and the example code
capture-example.c at linuxtv mercurial under v4l2-apps/test/capture-example.c

I think the implementation of those function in pwc has the following issues

1) it does not keep track of which buffers have been queued and behave as they 
are always queued and 
available to the driver
2) STREAMOFF does not destroy any buffer (since there is no list of them)
3) after STREAMOFF, since the list should be empty, DQBUF should return 
-EINVAL. pwc does not know 
about that and waits forever.
4) DQBUF should not block if a buffer is not ready and the device has been 
opened with O_NONBLOCK.

The hangs is due to the fact that mplayer calls
1) STREAMOFF
2) DQBUF in a loop (this should return -EINVAL, but pwc never returns, since it 
is waiting for a 
buffer that never arrives (STREAMOFF stops the reception from the camera))

I think mplayer could get rid of the redundant calls to DQBUF after STREAMOFF, 
but I don't think it 
qualifies as a bug.

I would like to have a second opinion about that before changing those 
functions in pwc.

Cheers

Andrea

_______________________________________________
pwc mailing list

http://lists.saillard.org/mailman/listinfo/pwc

<Prev in Thread] Current Thread [Next in Thread>
  • [pwc] About streaming in pwc with v4l2, Andrea <=
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU