Once buffering has started (with an mdat atom), continue buffering
until moov atom is reached, which handles cases with multiple
mdat atoms. Also keep adapter/offset better in sync with upstream
and fix some debug statements. Fixes#587426.
This reverts commit 5503a59a57.
Reverting this since it causes regressions with a lot of sample files
I have, all of which worked fine with the last -good release (#586891).
Whenever we alloc something based on a user-supplied size, we should
really use g_try_new(), otherwise we can easily be made to abort by
passing a ridiculously large number to us for allocing. Fixes
problems with some fuzzed files.
Check the possibly 64-bit atom size more carefully before casting it
to an int and passing it to gst_pad_pull_range(), otherwise we might
end up pulling 0 bytes, getting an empty buffer as requested and
dereferencing not available data whilst thinking we actually asked
for and got 0x1000000000000 bytes. Similar fix for push mode operation
where neededbytes ends up being 0 bytes, which makes us assert. Fixes
crash with broken or fuzzed file (NB #122378).
Fix the caps to include the depth (instead of width twice) in the caps of
audio/x-raw-int.
Fix negotiation to not only copy the rate/channels of the first structure.
Upper volume limmit was 1000. That appear unneceasrily high. It would also cause
sever distortion if accidentialy used. Now its 10 (~ +15db) which is also in
sync with volume and playbin2.
Since we map the ringbuffer to the pulseaudio internal ringbuffer, flush the
pulseaudio buffer when we are asked to clear the ringbuffer.
This avoids some leftover audio after a seek.
We need a cast here for pointer arithmetic to work correctly, but some
MSVC versions don't seem to like 'byte', so use guint8 here. Hopefully
fixes#585361.
Don't call gst_avi_demux_src_convert() for each single index entry. Not
only do we already have the pointer to the stream context, we also know
the formats we want to convert from and to already, so we may just as
well use optimised conversion routines that bypass some of the checks
and lookups made in gst_avi_demux_src_convert().
Include the header from where we include all the system headers with the
socket stuff before we try to define EAI_ADDRFAMILY ourselves, otherwise
we define it ourselves and then get a compiler warning if a system header
defines it as well without guarding against it being defined already.
Don't leak buffers when resyncing to a keyframe.
Avoid leaking buffers when exiting the loop on error conditions.
Add some more debug info.
Fixes#585911
Query the audio format, esp. dvdemux->num_channels, before we use that
variable to allocate the initial buffer. That way we don't accidentally
push a zero-sized buffer as first audio buffer.