From: Andrzej Hajda <a.hajda@samsung.com>
To: Hans Verkuil <hansverk@cisco.com>
Cc: linux-media@vger.kernel.org, hans.verkuil@cisco.com,
m.szyprowski@samsung.com, k.debski@samsung.com
Subject: Re: [PATCH 0/2] s5p-mfc: added encoder support for end of stream handling
Date: Wed, 23 May 2012 13:20:03 +0200 [thread overview]
Message-ID: <1337772003.1594.79.camel@AMDC1061> (raw)
In-Reply-To: <201205230943.19410.hansverk@cisco.com>
On Wed, 2012-05-23 at 09:43 +0200, Hans Verkuil wrote:
> Hi Andrzej!
>
> Thanks for the patch, but I do have two questions:
>
> On Tue 22 May 2012 17:33:53 Andrzej Hajda wrote:
> > Those patches add end of stream handling for s5p-mfc encoder.
> >
> > The first patch was sent already to the list as RFC, but the discussion ended
> > without any decision.
> > This patch adds new v4l2_buffer flag V4L2_BUF_FLAG_EOS. Below short
> > description of this change.
> >
> > s5p_mfc is a mem-to-mem MPEG/H263/H264 encoder and it requires that the last
> > incoming frame must be processed differently, it means the information about
> > the end of the stream driver should receive NOT LATER than the last
> > V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE buffer. Common practice
> > of sending empty buffer to indicate end-of-stream do not work in such case.
> > Setting V4L2_BUF_FLAG_EOS flag for the last V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE
> > buffer seems to be the most straightforward solution here.
> >
> > V4L2_BUF_FLAG_EOS flag should be used by application if driver requires it
>
> How will the application know that?
Application can always set this flag, it will be ignored by drivers not
requiring it.
I see some drawback of this solution - application should know if the
frame enqueued to the driver is the last one. If the application
receives frames to encode form an external source (for example via pipe)
it often does not know if the frame it received is the last one. So to
be able to properly queue frame to the driver it should wait with frame
queuing until it knows there is next frame or end-of-stream is reached,
in such situation it will properly set flag before queuing.
Alternative to "V4L2_BUF_FLAG_EOS" solution is to implement "wait for
next frame" logic directly into the driver. In such case application can
use empty buffer to signal the end of the stream. Driver waits with
frame processing if there are at least two buffers in output queue. Then
it checks if the second buffer is empty if not it process the first
buffer as a normal frame and repeats procedure, if yes it process the
first buffer as the last frame and releases second buffer.
The drawback of this solution is that it wastes resources/space
(additional buffer) and time (delayed encoding).
I am still hesitating which solution is better, any advices?
> > and it should be set only on V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE buffers.
>
> Why only for this type?
I wanted to say only for output buffers not just output multi-plane. And
why not capture? Explanation below.
Capture buffers are filled by driver, so only drivers could set this
flag. Some devices provides information about the end of the stream
together with the last frame, but some devices provides this info later
(for example s5p-mfc :) ). In the latter case to properly flag the
capture buffer driver should wait for next available frame. Simpler
solution is to use current solution with sending empty buffer to signal
the end of the stream.
Regards
Andrzej Hajda
next prev parent reply other threads:[~2012-05-23 11:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-22 15:33 [PATCH 0/2] s5p-mfc: added encoder support for end of stream handling Andrzej Hajda
2012-05-22 15:33 ` [PATCH 1/2] v4l: added V4L2_BUF_FLAG_EOS flag indicating the last frame in the stream Andrzej Hajda
2012-06-18 11:24 ` Mauro Carvalho Chehab
2012-06-18 11:54 ` Andrzej Hajda
2012-06-18 12:07 ` Mauro Carvalho Chehab
2012-05-22 15:33 ` [PATCH 2/2] s5p-mfc: added encoder support for end of stream handling Andrzej Hajda
2012-05-22 20:55 ` Sylwester Nawrocki
2012-05-23 7:43 ` [PATCH 0/2] " Hans Verkuil
2012-05-23 11:20 ` Andrzej Hajda [this message]
2012-05-23 12:28 ` Hans Verkuil
2012-06-04 12:37 ` Andrzej Hajda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1337772003.1594.79.camel@AMDC1061 \
--to=a.hajda@samsung.com \
--cc=hans.verkuil@cisco.com \
--cc=hansverk@cisco.com \
--cc=k.debski@samsung.com \
--cc=linux-media@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox