Commit graph

143 commits

Author SHA1 Message Date
Thiago Santos 5ac9476b40 videodecoder: do not parse caps for not using it
Saving some cpu
2014-05-01 19:31:25 -03:00
Thiago Santos 05e957106f videodecoder: do not deactivate the bufferpool, just unref
Videodecoder does late renegotiation, it will wait for the next
buffer before renegotiating its caps and bufferpool. It might happen
that downstream element switched from passthrough to non-passthrough
and sent a reconfigure upstream (that caused this renegotiation).
This downstream element will ask the video sink below for the bufferpool
with an allocation query and will get the same bufferpool that
videodecoder is holding, too.

When renegotiating, if videodecoder deactivates its bufferpool it
might be deactivating the bufferpool that some element downstream
is using and cause the pipeline to fail.

https://bugzilla.gnome.org/show_bug.cgi?id=727498
2014-04-04 13:50:03 -03:00
Sebastian Dröge 6189847ed0 videodecoder: Always drain the decoder after a discont group in reverse playback mode 2014-03-30 18:26:59 +02:00
Sebastian Dröge 5a4fbb1638 videodecoder: Flush the decoder once per discont group, not once per keyframe 2014-03-30 18:00:53 +02:00
Sebastian Dröge f1f8731ff5 videodecoder: Handle reverse playback with multiple GOPs per discont group properly
baseparse will reverse each GOP for us already, so the segment events can
be after our keyframe. Make sure to get it and all other relevant sticky
events before starting to decode.
2014-03-30 17:59:55 +02:00
Sebastian Dröge 50c2218d4d videodecoder: Log event types of events that are pushed downstream 2014-03-29 10:33:01 +01:00
Sebastian Dröge 1c26e5734c videodecoder: In reverse playback mode we need to finish the subclass after passing all frames to it 2014-03-29 10:33:01 +01:00
Sebastian Dröge 87829debe4 videodecoder: Add API to get the currently pending frame size for parsing
https://bugzilla.gnome.org/show_bug.cgi?id=719890
2014-01-18 13:54:22 +01:00
Thiago Santos 47f720a8f0 videodecoder: plug leak when frames are released on subclass stop
They end up stored in the 'pending_events' list and should be
freed after calling stop
2014-01-17 11:21:33 -03:00
Wim Taymans ecac298e4e videodecoder: only copy chroma_site when known
Only overwrite the chroma-site if we have a valid value in the reference
format.
2014-01-13 17:24:01 +01:00
Thiago Santos 672cda66db videodecoder: do not lose events when dropping frames
Events must be persisted after a frame is dropped to avoid
losing obligatory information for the stream.

https://bugzilla.gnome.org/show_bug.cgi?id=721835
2014-01-13 06:11:09 -03:00
Thiago Santos 5b8e1925b5 videodecoder: use new segment earlier for reverse playback
For reverse playback, the segment event will only be pushed when
the first buffer is actually pushed. But for decoding frames and storing
those into the list to be pushed the output_segment.rate value is used
to determine if it is forward or reverse playback.

In case a previous segment event (or none) is in use it will mistakenly
think it is doing forward playback and push the buffers immediatelly and
try to clip buffers based on an old segment (or an uninitialized one, leading
to an assertion)

This patch fixes this by copying the segment earlier if on reverse playback

https://bugzilla.gnome.org/show_bug.cgi?id=721666
2014-01-13 06:11:09 -03:00
Julien Isorce 2e38741b94 videodecoder: release buffer pool and allocator on full reset
It allows to release the buffer pool sooner (i.e. when going
to GST_STATE_READY). Previously it was released in finalize.

Fixes bug https://bugzilla.gnome.org/show_bug.cgi?id=720389
2013-12-16 16:07:05 +00:00
Sebastian Dröge b5d26f3907 videodecoder: gst_video_decoder_release_frame() is available since 1.2.2 2013-12-13 14:37:24 +01:00
Nicolas Dufresne 09a6ca97d2 videodecoder: Add sink_query() src_query() virtual
https://bugzilla.gnome.org/show_bug.cgi?id=720103
2013-12-09 09:41:46 -05:00
Julien Isorce 79ef75888c videodec/enc: clear reconfigure flag if negotiate succeeds
So that it avoids to send an allocation query twice.
One from an early call to gst_video_encoder_negotiate from a
subclass, then one from gst_video_encoder_allocate_output_frame.
Which means that previously gst_video_encoder_negotiate was not
clearing the GST_PAD_FLAG_NEED_RECONFIGURE even on success.

Fixes bug https://bugzilla.gnome.org/show_bug.cgi?id=719684
2013-12-05 15:19:16 +00:00
Sebastian Dröge 5acc099479 videodecoder: Add API to allow subclasses to specify that they needs caps before any buffers 2013-12-05 11:36:54 +01:00
Mark Nauwelaerts 40fc306017 videodecoder: make _release_frame external API
... so subclasses can release a frame all the way (also from frame list)
without having to pass through _finish_frame or _drop_frame.
The latter may not be applicable, or may or may not have already
been called for the frame in question.

See https://bugzilla.gnome.org/show_bug.cgi?id=693772
2013-12-01 12:06:37 +01:00
Mark Nauwelaerts 614d35d795 videodecoder: fix spelling error in debug message 2013-12-01 12:06:36 +01:00
Thiago Santos 81471099d2 videodecoder: error out if no frames are decoded before eos
Raise an error in case no frames are decoded before EOS and we
have input, meaning that data was received but it was somehow invalid.

https://bugzilla.gnome.org/show_bug.cgi?id=711094
2013-11-25 10:53:25 -03:00
Thiago Santos 0765962fbc videodecoder: allow using -1 for infinite tolerated errors
Allows using -1 to make videodecoder never post an error message
after decoding errors.

https://bugzilla.gnome.org/show_bug.cgi?id=711094
2013-11-25 10:53:14 -03:00
Mark Nauwelaerts ee86a91957 videodecoder: avoid descending output timestamps
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=712796
2013-11-23 19:39:52 +01:00
Sreerenj Balachandran cd52ff313e videodecoder: try to negotiate the buffer pool even though there is no o/p format
We could have allocation query before caps event and even without caps inside
the query. In such cases , the downstream can return a bufferpool object with
out actually configuring it. This feature is helpful to negotiate the bufferpool
with out knowing the output video format. For eg: some hardware accelerated
decoders can interpret the o/p video format only after it finishes the decoding
of one buffer at least.

https://bugzilla.gnome.org/show_bug.cgi?id=687183
2013-11-11 13:28:11 +01:00
Stefan Sauer 9269bee9bd videodecoder: don't overflow in bytes<->time conversion
fps_n and _d values can be large and this can overflow a uint. Also fix
copy'n'paste mistake in comments.
2013-10-08 09:15:21 +02:00
Olivier Crête c10311ba70 videodecoder: If there is no PTS at all, assume it starts from the segment start
This is to make the multifilesrc ! pngdec case work

https://bugzilla.gnome.org/show_bug.cgi?id=688043
2013-09-19 09:52:48 +02:00
Sebastian Dröge 35ee4b056b videodecoder/videoencoder: Mark pads as requiring reconfiguration again if negotiation fails
Otherwise we might end up in non-optimal configuration, especially
when a flush happened during reconfiguration.
2013-09-12 09:35:00 +02:00
Sebastian Dröge b0e4b5f69a videoencoder: Make sure to return TRUE if the same caps are set again 2013-08-25 10:26:30 +02:00
Edward Hervey d1cf4b2b9a videocoder: Don't push out identical caps
This avoids triggering plenty of extra code/methods/overhead downstream when
we can just quickly check whenever we want to set caps whether they are
identical or not

https://bugzilla.gnome.org/show_bug.cgi?id=706600
2013-08-23 15:22:43 +02:00
Sebastian Dröge c4d7ffddb5 videodecoder: Don't reset too much if we're resetting because of a soft-flush
Fixes reverse playback with Ogg/Theora.
2013-08-15 14:33:18 +02:00
Sebastian Dröge 695675ab7e videodecoder: Don't reset decoder on segment events
Either there was a flush before that resets everything anyway,
or resetting would make us lose information we might need if
it's just a segment update.
2013-08-15 13:26:39 +02:00
Sebastian Dröge 146bb1a153 video{en,de}coder: Add new flush vfunc as a replacement for reset 2013-08-15 13:26:39 +02:00
Sebastian Dröge 9df036c216 video{en,de}coder: Revert to old ::reset() behaviour and deprecate it 2013-08-15 13:26:38 +02:00
Youness Alaoui 17eb692c6a videodecoder: Clear taglist on reception of a STREAM_START event
https://bugzilla.gnome.org/show_bug.cgi?id=705109
2013-08-12 13:02:28 +02:00
Edward Hervey b4b9f74f8b videodecoder: Revert previous commit
The 'hard' argument of reset changed signification after the latest
start/stop/reset refactoring.
2013-08-02 08:22:59 +02:00
Edward Hervey 84d476610b videodecoder: Pass on 'hard' argument from _flush to _reset
When most of the code was moved from _flush() to _reset() the 'hard'
argument was no longer propagated.
2013-08-01 16:02:48 +02:00
Sebastian Dröge 047abdc944 videodecoder/encoder: Call reset() always between start() and stop() and never outside 2013-07-26 10:22:32 +02:00
Sebastian Dröge 9259ee6729 videoencoder/decoder: Call reset() before start() too 2013-07-25 14:25:31 +02:00
Sebastian Dröge 612a2cf9d0 videodecoder: Refactor GstVideoDecoder::reset() handling a bit
Let gst_video_decoder_reset() call it as would be intuitive and
only call it indirectly from gst_video_decoder_flush(). Now it
actually makes sense.
2013-07-25 10:25:34 +02:00
Wim Taymans 409cb22253 videodecoder: Take DTS as PTS for keyframes as a last resort if we can't calculate any PTS
https://bugzilla.gnome.org/show_bug.cgi?id=704193
2013-07-24 09:24:45 +02:00
Sebastian Dröge a00f4f239a videodecoder: Send all pending events with type < CAPS before sending caps 2013-07-01 11:16:34 +02:00
Sebastian Dröge 85eac2c31c video(enc|dec)oder: Don't return not-negotiated if flushing
If the pad is flushing after a failed negotiation, return
GST_FLOW_FLUSHING instead from finish_frame().

https://bugzilla.gnome.org/show_bug.cgi?id=701763
2013-06-30 18:17:47 +02:00
Edward Hervey 65624afd8f videodecoder: Fix drop frame handling at startup
In the unlikely case that the decoder drops a frame before the first
input frame is outputted, use the input segment (since it wasn't
carried over to the output segment yet)

https://bugzilla.gnome.org/show_bug.cgi?id=702502
2013-06-21 15:33:30 +02:00
Sebastian Dröge bd62595a75 videodecoder: Change GST_WARNING to a GST_DEBUG
It's completely normal for some decoders to queue 50-60 frames without
it causing any problems, e.g. RPi.
2013-06-04 17:49:55 +02:00
Sebastian Dröge 0c2c909497 video: Always provide a buffer in gst_video_(enc|dec)oder_allocate_output_buffer()
We have no way of tell the caller of the exact error (e.g. if we're flushing),
so will have to wait until the caller uses API that returns a GstFlowReturn,
for example when pushing this buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=700006
2013-05-24 16:54:46 +02:00
Mathieu Duponchelle 6f233f67ef videodecoder: don't set the list to NULL after taking its address 2013-05-10 09:22:07 +02:00
Sebastian Dröge 82f1572205 videodecoder: Make sure to not push any post-caps events before we have caps
and that we push pre-caps events before we push caps, even if we don't
have a GstVideoFrame yet.
2013-05-09 16:05:59 +02:00
Sebastian Dröge ba8e7062a4 Revert "videodecoder: If a frame is to be dropped, don't update timestamps"
This reverts commit c9c5cd8eef.
2013-05-09 10:37:06 +02:00
Sebastian Dröge c9c5cd8eef videodecoder: If a frame is to be dropped, don't update timestamps 2013-05-09 08:54:45 +02:00
Sebastian Dröge 3e4aec6e7b video: Make sure to push pre-caps events before the caps event
https://bugzilla.gnome.org/show_bug.cgi?id=699894
2013-05-08 15:50:34 +02:00
Sebastian Dröge 0be8d14965 videodecoder: Try harder to push writable buffers downstream
For this release the corresponding GstVideoCodecFrame before
pushing the buffer. The buffer will now be writable unless
the subclass still holds another reference to the buffer or
the frame.
2013-04-25 16:13:10 +02:00