Commit graph

1436 commits

Author SHA1 Message Date
Tim-Philipp Müller bbec3d4e2f queue2: fix possible data corruption in ring buffer mode when seeking
Fix race that could cause data corruption when seeking in ring buffer
mode.

In perform_seek_to_offset(), called from the demuxer's pull_range
request, we drop the lock, tell upstream (usually a http source)
to seek to a different offset, then re-acquire the lock before we
do things to the ranges. However, between us sending the seek event
and re-acquiring the lock, the source thread might already have pushed
some data and moved along the range's writing_pos beyond the seek
offset. In that case we don't want to set the writing position back
to the requested seek position, as it would cause data to be written
to the wrong offset in the file or ring buffer.

Reproducible doing seek-emulated fast-forward/backward on 006653.
2012-09-12 12:31:04 +01:00
Thiago Santos a396ba2bde inputselector: avoid notify-tags holding lock
unlock before issuing this notification to prevent
deadlocks when other elements reacts to new tags.

Fixes #678220
2012-06-21 10:24:46 -03:00
David Svensson Fors 70a95ff5c7 gstfunnel: avoid access of freed pad
Save the value of the pad's got_eos in gst_funnel_release_pad,
before calling gst_element_remove_pad. This is because
gst_element_remove_pad may free the pad.

https://bugzilla.gnome.org/show_bug.cgi?id=678017
2012-06-14 14:09:57 +01:00
Andre Moreira Magalhaes (andrunko) 2424d9896c inputselector: Correctly get current running time when syncing to the segment information
Fixes bug #677263.
2012-06-01 16:36:19 +02:00
Olivier Crête 5431af5415 funnel: Release object lock before pushing EOS event
When releasing a pad, if all other pads are EOS, then release
the object lock before sending an EOS.
2012-05-31 13:24:08 -04:00
Mike Ruprecht d397ea972d funnel: Only emit EOS event if all sinkpads have received one
If multiple sources are plugged into the funnel and one of the
sources emits an EOS, that event is propogated through the funnel
even though other sources connected to the funnel may still be
pushing data. This patch waits to send an EOS event until the
funnel has received an EOS event on each sinkpad.
2012-05-31 12:58:00 -04:00
Mike Ruprecht 03ce735b07 funnel: Fix buffer leak 2012-05-31 12:58:00 -04:00
Andre Moreira Magalhaes (andrunko) 8f267451f4 inputselector: Don't try to sync on the segment if it has no TIME format
...and wait until it is actually configured and has a format before
trying to sync.
2012-05-31 17:45:29 +02:00
Sebastian Dröge e8e9c45c21 inputselector: No need to broadcast the signal in flush-stop
Everything stopped at this point already.
2012-05-31 17:03:54 +02:00
Bastien Nocera cdb3087746 queue2: Fix property name in the docs
temp-template, not temp-tmpl

https://bugzilla.gnome.org/show_bug.cgi?id=677170
2012-05-31 12:56:47 +02:00
Andre Moreira Magalhaes (andrunko) cd798a0a52 inputselector: Properly sync when changing streams
This adds properties to use the clock time for deciding when
to drop buffers for inactive pads and a property to buffer all
not rendered buffers for the active pad to allow pad switching
without losing any buffers at all.
2012-05-31 11:49:29 +02:00
Idar Tollefsen 7a70c91ac3 configure: explicitly check for sys/mman.h header
And use header-specific guards.

https://bugzilla.gnome.org/show_bug.cgi?id=667292
2012-05-15 19:05:42 +01:00
Tim-Philipp Müller f85885474c filesrc: remove unused or questionable madvise() calls in deprecated mmap code paths
use-mmap functionality has been removed in 0.11 and doesn't really
have any performance advantages in most cases anyway. Deprecate
"sequential" property to hint sequential access in mmap mode and
make it non-functional. Chances are no one was using this ever
anyway, or inappropriately.

Remove madvise() calls. We would need to do extensive configure
checks to handle these properly on different systems, and it
doesn't seem worth adding that for code that's already removed
in 0.11 or questionable anyway (like madvise DONTNEED right
before munmap).

https://bugzilla.gnome.org/show_bug.cgi?id=667292
2012-05-15 18:43:59 +01:00
Wim Taymans bdda711d03 queue2: signal delete before waiting
When we don't have the requested data in the ringbuffer and we move our read
pointer to the requested position, signal the delete cond to inform the writer
that we changed the current fill level. If we don't, the writer might stay
blocked and we might wait forever.
2012-04-11 12:45:46 +02:00
Wim Taymans ccbeb19881 queue2: update current read position before waiting
When we don't have enough bytes in the ringbuffer to satisfy the current
request, first update the current read position before waiting. If we don't do
that, the ringbuffer might appear full and the writer will never write more
bytes to wake us up.
2012-04-11 12:45:41 +02:00
Wim Taymans 463a8d9abf queue2: add range only on sinkpad
Only add the range when we receive a segment event on the sinkpad. The add_range
method will modify the write position, which only makes sense to do on the
sinkpad.
2012-04-11 12:45:37 +02:00
Wim Taymans e3ca88ea7b queue2: fix debug message
We're not writing to the offset of the buffer
2012-04-11 12:45:31 +02:00
Wim Taymans 30c425c29f queue2: add_range already updates the level 2012-04-11 12:45:24 +02:00
Wim Taymans 2e28804a6e queue2: clear seeking flag in all cases
Also clear the seeking flag when downstream is in pull mode.
2012-04-10 16:06:41 +02:00
Wim Taymans b7a8051d95 queue2: set seeking flag with the queue lock 2012-04-10 12:44:38 +02:00
Wim Taymans 5755e24379 queue2: Keep track of the seeking state
Set the seeking flag right before we send a seek event upstream and discard all
data untill we see a flush-stop again. We need to do this because we activate
the range that we seek to immediately after sending the seek event and it is
possible that we receive data in our chain function from before the seek
which would then be added to the wrong range resulting in data corruption.
2012-04-10 12:44:35 +02:00
Wim Taymans 49a4b801ac queue2: make range on newsegment for ringbuffer
When using the ringbuffer, handle the newsegment event like we handle it when
using the temp-file mode: create a new range for the new byte segment. The new
segment should normally already be created when we do a seek.
2012-04-10 12:44:30 +02:00
Sebastian Dröge 829eafad0e multiqueue: Don't use buffer after pushing it downstream 2012-04-09 16:40:47 +02:00
Tim-Philipp Müller d05d29d0c9 filesrc: set default block size from local define
Doesn't actually change the default value, just makes use of the
define there is. Superficial testing with fakesink and jpegdec did
not reveal improved performance for bigger block sizes, so leave
default as it is.
2012-04-07 15:21:29 +01:00
Wim Taymans 4638f15de2 queue2: don't update the current reading_pos in flush
A flush from the upstream element should not make buffering go to 0, the next
pull request might be inside a range that we have and then we don't need to
buffer at all. If the next pull is outside anything we have, buffering will
happen as usual anyway.
2012-04-06 16:46:58 +02:00
Wim Taymans d8a61930af queue2: check the pad mode on the right pad 2012-04-06 12:32:49 +02:00
Wim Taymans f06458aabc queue2: forward flush events correctly
We want to forward the flush events received on the sinkpad whenever the srcpad
is activated in pushmode, which can also happen when using the RINGBUFFER or
DOWNLOAD mode and downstream failed to activate us in pull mode.
2012-04-06 12:24:22 +02:00
Wim Taymans 67ccad0621 queue2: stop waiting for more data after EOS
When we have EOS, read the remaining bytes in the buffer and make sure we don't
wait for more data. Also clip the output buffer to the amount of remaining
bytes.
2012-04-05 10:17:46 +02:00
Wim Taymans 9a1185673e queue2: check for filled buffer correctly
When using the ringbuffer mode, the buffer is filled when we reached the
max_level.bytes mark or the total size of the ringbuffer, whichever is smaller.
2012-04-05 10:16:52 +02:00
Wim Taymans 0bb0c68566 queue2: avoid waiting for a filled buffer
Use a threshold variable to hold the maximum distance from the current position
for with we will wait instead of doing a seek.
When using the ringbuffer and the requested offset is not available, avoid
waiting until the complete ringbuffer is filled but instead do a seek when the
requested data is further than the threshold.
Avoid doing the seek twice in the ringbuffer case.
Use the same threshold for ringbuffer and download buffering.
2012-04-05 10:16:46 +02:00
Sebastian Dröge 9441e711df multiqueue: Wake up all not-linked streams when a stream switches from linked to not-linked
We reset all the waiting streams, let them push another buffer to
see if they're now active again. This allows faster switching
between streams and prevents deadlocks if downstream does any
waiting too.

Also improve locking a bit, srcresult must be protected by the
multiqueue lock too because it's used/set from random threads.
2012-03-29 14:49:53 +02:00
Sebastian Dröge 17e691421f multiqueue: Recompute high-time too when flushing, not only high-id 2012-03-29 14:47:57 +02:00
Sebastian Dröge d03e3d7772 inputselector: Only wait until the active pad's running time is reached if the active pad already saw data
Otherwise we might block forever because upstream (e.g. multiqueue) is waiting
for the previously active stream to return forever (which is waiting here
in inputselector) before pushing something on the newly selected stream.
2012-03-29 14:47:57 +02:00
Sebastian Dröge f000bbe924 tee: Fix 'use of logical '&&' with constant operand' compiler warning
This is actually a real bug.
2012-03-06 12:27:33 +01:00
Tim-Philipp Müller 4594e4311d fdsink: implement GstBaseSink::query instead of messing with the pad 2012-02-25 15:18:00 +00:00
Tim-Philipp Müller 965c610028 fdsink: implement SEEKING query
We may or may not support seeking. stdout to a
terminal doesn't support seeking, for example, but
... ! fdsink > file.foo just might.
2012-02-25 15:08:55 +00:00
Tim-Philipp Müller 82a9544385 filesink: implement SEEKING query
We may or may not do seeking, depends on the
output file/device really, it doesn't have to
be a file after all.
2012-02-25 15:07:43 +00:00
Tim-Philipp Müller c5b335a0e2 fakesink: answer SEEKING query
We don't do seeking, in case anyone wants to know.
2012-02-25 15:07:05 +00:00
Idar Tollefsen b9b3795c3c plugins: explicitly cast initialization values to the correct type
https://bugzilla.gnome.org/show_bug.cgi?id=667288
2012-01-04 23:59:57 +00:00
Thiago Santos 71fe1ad070 output-selector: Do not false warn about unlinked pad
When output-selector didn't receive a newsegment event it would
warn about pad being unlinked when switching pads. Making the logs
wrong and misleading.
2011-12-29 16:59:29 -03:00
Tim-Philipp Müller 8a932dbca6 filesrc: return any remaining data on EOS before returning FLOW_UNEXPECTED 2011-12-25 12:42:11 +00:00
Tim-Philipp Müller cf5de908fb filesrc: minor cosmetic changes
Rename woffset variable, maintain separate bytes_read in addition
to length variable.
2011-12-25 12:29:46 +00:00
Vincent Penquerc'h 431fc714c9 filesrc: do not mistake short reads for EOS
While local filesystems will usually not cause short reads,
this may happen on seekable files on some remote filesystems.
Instead, loop till we get the requested amount of data, or
an actual EOS (ie, 0 bytes).

https://bugzilla.gnome.org/show_bug.cgi?id=665921
2011-12-12 13:35:06 +00:00
Sebastian Dröge 47de97df84 inputselector: Don't send a NEWSEGMENT event if a buffer arrived before the segment was configured 2011-12-07 11:01:49 +01:00
Sebastian Dröge 7952a54299 outputselector: Don't send last segment/buffer when no segment was configured yet 2011-12-07 11:01:31 +01:00
Sebastian Dröge c8909ab059 fakesink: Make event/buffer verbose output consistent with identity 2011-12-06 14:55:57 +01:00
Sebastian Dröge b7b84671ba identity: Print buffer flags in the verbose output 2011-12-06 14:55:57 +01:00
Sebastian Dröge 675e54f1f4 fakesrc: Make event/buffer verbose output consistent with identity and print buffer flags 2011-12-06 14:55:57 +01:00
Tim-Philipp Müller 2666450864 Suppress deprecation warnings in selected files, for g_static_rec_mutex_* mostly
GStaticRecMutex is part of our API/ABI, not much we can do here in 0.10.
2011-12-04 14:38:26 +00:00
Tim-Philipp Müller 5889260d5a Work around deprecated thread API in glib master
Add private replacements for deprecated functions such as
g_mutex_new(), g_mutex_free(), g_cond_new() etc., mostly
to avoid the deprecation warnings. We can't change most of
these in 0.10 because they're part of our API and ABI.
2011-12-04 13:35:38 +00:00