Commit graph

118 commits

Author SHA1 Message Date
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
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
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
Tim-Philipp Müller
3b28af5171 queue2: fix refactoring of draining-on-eos, munge flow return to FLOW_OK 2011-11-28 01:10:20 +00:00
Tim-Philipp Müller
2a3e7c4feb queue2: add bufferlist support
We want to maintain buffer lists if possible.
2011-11-28 00:16:40 +00:00
Tim-Philipp Müller
d663e18402 queue2: split out draining of queue on FLOW_UNEXPECTED into separate function 2011-11-28 00:16:40 +00:00
Tim-Philipp Müller
c9df12754d queue2: pass item type enum to _enqueue instead of simple isbuffer boolean
Avoids some unnecessary GST_IS_EVENT()
2011-11-28 00:16:40 +00:00
Tim-Philipp Müller
cc279e6bdd queue2: use statically allocated GQueue 2011-11-03 22:41:13 +00:00
Piotr Fusik
14f5518f3d docs, gst: typo fixes
https://bugzilla.gnome.org/show_bug.cgi?id=658449
2011-09-07 18:03:17 +01:00
Tim-Philipp Müller
a7644b3b1c queue2: fix deadlock in error path
Don't lock the same lock twice. Spotted by Josep Torre Valles.
2011-08-12 19:44:35 +01:00
Mark Nauwelaerts
fe1dcbe6fa queue2: adjust input data rate estimation
... being aware of possible initial higher burst rate.
2011-05-16 12:20:51 +02:00
Sebastian Dröge
8839c513f7 queue2: Add missing ) to the ring-buffer-max-size property description 2011-04-15 13:59:02 +02:00
Janne Grunau
b2e6870edc queue2: prevent calculation with GST_CLOCK_TIME_NONE in update_time_level() 2011-04-13 17:35:39 +02:00
Havard Graff
d092e3b9ff queue[2]: Make src query MT-safe
It is possible that the element might be going down while the event arrives
2011-04-08 14:58:51 +02:00
Sebastian Dröge
1dac816e9c queue[2]: Unref events if the parent element disappeared 2011-04-08 14:57:18 +02:00
Havard Graff
d5485786a4 queue[2]: Make upstream events MT-safe 2011-04-08 14:57:05 +02:00
Stian Selnes
339df347a0 gstqueue, gstqueue2: check if parent of pad is NULL in _getcaps
Parent of the pad (the queue) may be set to NULL while there is
a buffer alloc going on.
2011-04-08 14:51:06 +02:00
Tim-Philipp Müller
12249e99c2 queue2: fix buffer leak on eos when using the ring buffer 2011-04-07 20:50:04 +01:00
Idar Tollefsen
46a786cee6 queue2: Fixes memory leak on out_flushing error in gst_queue2_create_read.
https://bugzilla.gnome.org/show_bug.cgi?id=646972
2011-04-07 20:50:04 +01:00
Tim-Philipp Müller
419d117851 queue2: fix minor memory leak 2011-04-07 20:50:04 +01:00
Stefan Kost
1177a968cc queue2: set max value for to the matching one for the datatype
The property is guint64, so use G_MAXUINT64 instead of G_MAXUINT.
2011-03-24 18:32:20 +02:00
Mark Nauwelaerts
8bf4c1e1a8 queue2: don't read beyond the end of file upstream in pull mode
... which could lead to a premature eos being reported downstream,
rather than a successful partial read which would result when
performed directly on e.g. basesrc.
2011-02-15 14:51:20 +01:00
Mark Nauwelaerts
e14c133587 queue2: properly identity dequeued event as such
... which avoids terminating with ERROR rather than UNEXPECTED.
2011-02-02 15:37:38 +01:00
Mart Raudsepp
b387daa6ff docs: Fix GstQueue2:ring-buffer-max-size property Since tag (0.10.31, not 0.10.30) 2011-01-24 14:38:36 +00:00
Tim-Philipp Müller
d692735f49 coreelements: GST_BOILERPLATE already sets parent_class 2010-12-31 00:56:11 +00:00
Edward Hervey
8f12a5e7cd queue2: Only call update_buffering if needed.
update_buffering is so big it will never be inlined (and shouldn't),
we therefore move the check outside of it.
2010-12-02 19:04:57 +01:00
Edward Hervey
66bba2a49e queue2: Avoid re-checking many times whether an item is a buffer
Avoids calling 6 times gst_buffer_get_type() for every item coming
through queue2
2010-12-02 19:04:56 +01:00
Edward Hervey
080c965f4f queue2: Reduce amount of time locks are taken 2010-12-02 19:04:56 +01:00
Edward Hervey
ccb9ed2e80 queue2: Fixup documentation of some properties 2010-12-02 19:04:56 +01:00
Edward Hervey
8a79c1aa98 queue2: Avoid useless segment_to_running_time() calculations.
* Cache src and sink time
* Use a boolean to known whether src/sink time needs to be recalculated

Avoids 50% of calls to gst_segment_to_running_time()
2010-12-02 19:04:56 +01:00
Sebastian Dröge
6720373610 queue2: Remove dead assignment and unused variable 2010-12-02 19:02:08 +01:00
Sebastian Dröge
3b9d85d1a7 queue2: Remove dead assignment and move variable declaration into inner block 2010-12-02 19:02:08 +01:00
Sebastian Dröge
e554c7a1f6 queue2: Remove redundant variable
Other than saving an immense amount of 4 bytes of memory this
prevents clang from complaining and keeps the ring buffer state
in a single variable instead of two.
2010-12-02 19:02:08 +01:00
Tim-Philipp Müller
2ee5e4d8ac queue2: don't leak pad ref in pull mode when flushing
Fix pad leak when queue2 is flushing or being shut down.
2010-11-01 12:34:15 +00:00
Tim-Philipp Müller
ce35fb79da queue2: don't send seeks beyond the end of the file upstream in pull mode
If downstream is operating in pull mode, short-circuit any pulls beyond
the end of the file and return FLOW_UNEXPECTED immediately instead of
sending a seek beyond the end of the file upstream, since this might
confuse upstream elements (and/or http servers, for example). Fixes
playback of apple trailers in totem and youtube/html5 clips in
WebkitGTK+.

https://bugzilla.gnome.org/show_bug.cgi?id=632977
2010-11-01 12:34:15 +00:00
Edward Hervey
cb2c028b39 queue2: Remove unused argument from find_range() 2010-10-13 12:05:44 +02:00
Wim Taymans
62ffd66f10 queue2: release queue2 lock before notify
Make sure that we don't hold the lock when we notify the temp-location
property,

Fixes #631853
2010-10-11 18:10:07 +02:00