public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Dufresne <nicolas.dufresne@gmail.com>
To: "Wu-Cheng Li (李務誠)" <wuchengli@google.com>,
	linux-media@vger.kernel.org, "Hans Verkuil" <hverkuil@xs4all.nl>,
	pawel@osciak.com
Cc: Tiffany Lin <tiffany.lin@mediatek.com>
Subject: Re: V4L2_DEC_CMD_STOP and last_buffer_dequeued
Date: Fri, 14 Oct 2016 14:20:29 -0400	[thread overview]
Message-ID: <1476469229.4684.70.camel@gmail.com> (raw)
In-Reply-To: <CAOMLVLj9zwMCOCRawKZKDDtLkwHUN3VpLhpy2Qovn7Bv1X5SgA@mail.gmail.com>

Le mercredi 12 octobre 2016 à 23:33 +0800, Wu-Cheng Li (李務誠) a écrit :
> I'm trying to use V4L2_DEC_CMD_STOP to implement flush. First the
> userspace sent V4L2_DEC_CMD_STOP to initiate the flush. The driver
> set
> V4L2_BUF_FLAG_LAST on the last CAPTURE buffer. I thought implementing
> V4L2_DEC_CMD_START in the driver was enough to start the decoder. But
> last_buffer_dequeued had been set to true in v4l2 core. I couldn't
> clear last_buffer_dequeued without calling STREAMOFF from the
> userspace. If I need to call STREAMOFF/STREAMON after
> V4L2_DEC_CMD_STOP, it looks like V4L2_DEC_CMD_START is not useful.
> Did
> I miss anything?

It's likely what the driver do is slightly off what the spec say. All
user space code so far seems to only drain at EOS. As the next buffer
is a new stream, it make sense to completely reset the encoder. We'd
need to review that, but using CMD_START should work if you queue a
header first.

Note that for many a flush is the action of getting rid of the pending
images and achieve by using STREAMOFF. While the effect of CMD_STOP is
to signal the decoder that no more encoded image will be queued, hence
remaining images should be delivered to userspace. They will
differentiate as a flush operation vs as drain operation. This is no
rocket science of course.

regards,
Nicolas

  reply	other threads:[~2016-10-14 18:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-12 15:33 V4L2_DEC_CMD_STOP and last_buffer_dequeued Wu-Cheng Li (李務誠)
2016-10-14 18:20 ` Nicolas Dufresne [this message]
2016-10-15  0:16   ` Wu-Cheng Li (李務誠)
2016-10-17 13:46     ` Nicolas Dufresne
2016-10-17 16:16       ` Wu-Cheng Li (李務誠)

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=1476469229.4684.70.camel@gmail.com \
    --to=nicolas.dufresne@gmail.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=nicolas@ndufresne.ca \
    --cc=pawel@osciak.com \
    --cc=tiffany.lin@mediatek.com \
    --cc=wuchengli@google.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