After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 785237 - omxvideodec: Fix segment seek
omxvideodec: Fix segment seek
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-omx
unspecified
Other All
: Normal normal
: 1.13.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-07-21 15:59 UTC by Nicolas Dufresne (ndufresne)
Modified: 2017-07-25 14:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
omxvideodec: Fix segment seek (1.84 KB, patch)
2017-07-21 15:59 UTC, Nicolas Dufresne (ndufresne)
committed Details | Review

Description Nicolas Dufresne (ndufresne) 2017-07-21 15:59:48 UTC
The segment seek stalled since the decoder state was not reset after drain.
It's a bit like GStreamer, you need to reset after sending the decoder an
EOS signal, otherwise it rejects incoming buffers. This was tested on Tegra
OMX.
Comment 1 Nicolas Dufresne (ndufresne) 2017-07-21 15:59:51 UTC
Created attachment 356127 [details] [review]
omxvideodec: Fix segment seek

On segment seek, unlike EOS, we drain, but we cannot expect a flush
later to reset the decoder state. As a side effect, the decoder would
remain in EOS state and ignore any new incoming buffers.

To fix this, we call _flush() inside the _drain() function, and
_finish() becomes what _drain() was before. This way, for _finish() (the
    eos case) we only drain, for _drain() triggered by segment seek or new
caps, we also reset the decoder state so it's ready to accept buffers.
Comment 2 Olivier Crête 2017-07-21 16:34:45 UTC
Review of attachment 356127 [details] [review]:

Looks good!
Comment 3 Nicolas Dufresne (ndufresne) 2017-07-21 16:52:15 UTC
Attachment 356127 [details] pushed as 64f7f78 - omxvideodec: Fix segment seek
Comment 4 Julien Isorce 2017-07-21 19:33:50 UTC
Is it applicable to gstomxaudiodec.c as well ?
Comment 5 Nicolas Dufresne (ndufresne) 2017-07-22 02:01:08 UTC
(In reply to Julien Isorce from comment #4)
> Is it applicable to gstomxaudiodec.c as well ?

Good question, I was doing segment seek on video only file here, so I didn't notice. Please find my test program here, in case you have a chance to test before me, https://paste.fedoraproject.org/paste/1vi9Fp9RwshNoHs93UZdoQ

The second benefit of doing this is that it prevents buggy component that would drain early and keep pushing old buffer from messing things up (the base class gets really confused in this case).
Comment 6 Nicolas Dufresne (ndufresne) 2017-07-22 02:23:36 UTC
Actually, on the audio side, the porting to 1.0 went pretty wrong. The base class does not send a NULL buffer anymore on EOS (it used to in 0.10), only the remaining data in the adapter is being pushed and the base class assumed that decoding is synchronous.

We should in theory see "still %d frames left after draining" warning pretty often unless lucky. This should be filed seperatly, as EOS is also affected here. We might need to go over all the audio decoder in fact.
Comment 7 Nicolas Dufresne (ndufresne) 2017-07-22 02:35:50 UTC
Sorry, miss-read the code, it does send an empty buffer to signal the drain, we just need to figure-out if it works for segment seeks or not.
Comment 8 Julien Isorce 2017-07-25 08:20:45 UTC
I have not got a chance to test with audio yet but I have a question. Your change is in the block "needs_disable && is_format_change". So your video contains a resolution change at some point ? Otherwise can you explain why seeking to 0 causes to have both needs_disable and is_format_change to be true ? (could it be because your element set some "hacks" field in gstomx.conf ?) Thx!
Comment 9 Nicolas Dufresne (ndufresne) 2017-07-25 12:32:46 UTC
(In reply to Julien Isorce from comment #8)
> I have not got a chance to test with audio yet but I have a question. Your
> change is in the block "needs_disable && is_format_change". So your video
> contains a resolution change at some point ? 

I'm not sure why you say that. No, just a video being looped, single resolution.

> Otherwise can you explain why
> seeking to 0 causes to have both needs_disable and is_format_change to be
> true ? (could it be because your element set some "hacks" field in
> gstomx.conf ?) Thx!

I'm not sure how to correlate this comment against my patch really. All I do is flush after drain to reset the decoder state (otherwise it's stuck in EOS). Wrong bug # ?
Comment 10 Julien Isorce 2017-07-25 14:10:21 UTC
Oki I see it is just a collateral damage that you changed that other block.
There is no ->drain and ->finish for the audio base classes so it does not look to be applicable to gstomxaudiodec.c . So I do not plan further digging regarding this issue. Thx!