[gst-devel] How to control pipeline frame rate when my camera needs some time to get one frame data
Stefan Kost
ensonic at hora-obscura.de
Thu Nov 19 22:16:51 CET 2009
Edward Hervey schrieb:
> On Wed, 2009-11-18 at 16:24 +0800, Zhao, Halley wrote:
>> But the timestamp will be mess.
>>
>> You could get some frames in a short time, then idle some time, then
>> another some frames.
>
> What thiagoss recomended is correct (you basically end up with one
> thread dedicated to capture the image and the other threads doing the
> extra processing).
> Timestamping is done at the source element (i.e. the timestamp will be
> the moment at which the image is captured).
Unfortunately not entierly correct. The timestamp is the time when the capture
thread actualy gets scheduled :/ Sometimes using the timestampo provided by v4l2
itself would be better, but this would need skew slaving ...
Running the capture thread with SCHED_RR helps a lot.
Stefan
>
> If you were to give the gst-launch pipeline you're testing with we
> could give you more info.
>
>
> Edward
>
>>
>>
>>
>>
>>
>> ______________________________________________________________________
>> From:thiagossantos at gmail.com [mailto:thiagossantos at gmail.com]
>> Sent: 2009年11月18日7:19
>> To: Discussion of the development of GStreamer
>> Subject: Re: [gst-devel] How to control pipeline frame rate when my
>> camera needs some time to get one frame data
>>
>>
>>
>>
>>
>>
>> On Tue, Nov 17, 2009 at 8:11 PM, Zhao, Halley <halley.zhao at intel.com>
>> wrote:
>>
>> Hi all:
>>
>> My camera needs ~20ms to get one frame of data, and a video sink in
>> the pipeline needs ~4ms to render it.
>>
>> But when I set pipeline fps to 35, I only got 20 fps (calculate by GST
>> CLOCK). CPU is not busy at this time, only 60%.
>>
>>
>>
>> I guess the reason is following:
>>
>> When we got nth frame at time 0, gst framework schedule to get next
>> frame after 30ms (1000/35), and when the camera src element got
>> scheduled to create one frame, it needs 20ms to get the data.
>>
>> Then the time between n frame and n+1 frame is 30+20=50ms, so I just
>> got 20 fps.
>>
>> Is my assumption right?
>>
>> If yes, is there any way to adjust it?
>>
>>
>> You can speed it up by adding a queue right after your source element.
>> It will create another thread to push data after it, the thread used
>> to request a frame from the camera will quickly return to the source
>> and it will request another one.
>>
>>
>>
>>
>>
>> I had though to create another thread inside camera source,
>> and prepare the frame data in a buffer before it is schedule.
>>
>> However, I think it is hack, and make timestamp differ. I
>> think it’s better settled inside gst framework.
>>
>>
>>
>>
>>
>> ZHAO, Halley (Aihua)
>>
>> Email: halley.zhao at intel.com
>>
>> Tel: +86(21)61166476
>>
>> iNet: 8821-6476
>>
>> SSG/OTC/Moblin 3W038 Pole: F4
>>
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal
>> Reports 2008 30-Day
>> trial. Simplify your report design, integration and deployment
>> - and focus on
>> what you do best, core application coding. Discover what's new
>> with
>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>>
>>
>>
>>
>> --
>> Thiago Sousa Santos
>>
>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
>> trial. Simplify your report design, integration and deployment - and focus on
>> what you do best, core application coding. Discover what's new with
>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>> _______________________________________________ gstreamer-devel mailing list gstreamer-devel at lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
More information about the gstreamer-devel
mailing list