Adds chained asfs handling to pull mode. It now checks if
there is a new asf header after the last packet (when it
is possible to know how many packets are) or it tries
checking if a processed packet that fails is an header
object.
Fixes#599718
Adds support for detecting and playing chained asfs
in push mode. asfdemux tries to detect a new asf start
by identifying the header object guid in a input buffer.
When it finds it, it resets its state, removing its pads
and creates new ones for the new file.
This also fixes a bug by which the first buffer (in a multi-packet mode)
passed to asf_demux_parse_packet() would have a GST_BUFFER_SIZE of the
full incoming buffer and not just of the single asf packet.
Fixes corrupted frames introduced by latest commit.
We now have a chance for packets to be collected before we send out the
newsegment. If we're not in accurate seeking (keyunit) it will set
the segment start/time to the keyframe's timestamp.
We now *always* seek to the keyframe just before our requested position.
When we encounter the first keyframe and we were not accurate (therefore doing
keyframe seeking), we update the segment start position to the keyframe timestamp.
This will still cause some timestamp jitter, but giving a hint as to the duration
rather than nothing seems to be a better idea.
Also, this allows some scenarios (like remuxing with asfmux) to estimate the total
duration using the accumulated packet duration (which will be correct).
The simple index entries also contain the number of packets one needs
to retrieve at a given position to get a full keyframe. We therefore
use that information to retrieve all those packets in one buffer when
working in pull-mode.
In gst_asf_demux_chain_headers, when 'goto wrong_type' was called
asfdemux tried to free a const pointer that had been cast to a
normal pointer variable.
We weren't taking the preroll into account previously, meaning that we
were always seeking preroll nanoseconds too early... resulting in a lot
of dropped packets (which are before the start time).
This brings quit a bit closer to as-fast-as-possible seeking in asf files.
Post global tags only after we've added our source pads, so that
tag events get sent downstream in addition to tag messages posted
on the bus. This makes sure tags can be picked up automatically
when transcoding, but also by tagreadbin/playbin2. Fixes#519721.
While we're at it, also add a container-format tag.
When we receive a DISCONT as input, don't clear our complete state but simply
mark a discont that will be put on the next buffer. The code will be able to
handle and throw away incomplete data.
Add some more debug info.
Remove an unused variable.
Don't overwrite the origin flow return by whatever flow we get
when trying to push the remaining internally queued payloads.
We want to do our eos logic, ie. send an EOS event or segment-done
message in any case. Makes things EOS properly when an EOS event
is forced upon the pipeline so that the source returns
FLOW_UNEXPECTED to a pulling asfdemux. Should fix#582056.
This also makes timestamps (more) consistent before and after a possible
seek, and moreover makes for reasonable position reporting in live stream
(whose payload timestamps should not be taken for granted).
* Improve newsegment handling, e.g. upstream might live in TIME.
* Only send newsegment if we have needed info.
* Avoid reading past end of data section.
This might be caused by entering the if() line 1214 and then not having
any activated_streams.. resulting in reaching line 1267 without having
any valid flow value.
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_chain):
Remove duplicate and broken code for the streaming case and simply reuse
the much better working pull based code. Fixes#560348.