Commit graph

248 commits

Author SHA1 Message Date
Sebastian Dröge
f51a23a83c Merge branch 'master' into 0.11 2011-04-16 08:59:58 +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
Wim Taymans
6be4dbdb5a Merge branch 'master' into 0.11
Conflicts:
	android/base.mk
	android/controller.mk
	android/dataprotocol.mk
	android/elements.mk
	android/gst-inspect.mk
	android/gst-launch.mk
	android/gst-plugin-scanner.mk
	android/gst.mk
	android/indexers.mk
	android/net.mk
	win32/common/libgstbase.def
2011-04-11 10:26:54 +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
Wim Taymans
a12ede3fb1 Merge branch 'master' into 0.11-fdo
Conflicts:
	gst/gst.c
	libs/gst/base/gstcollectpads.c
2011-03-28 20:11:20 +02:00
Wim Taymans
d82c8bd2af memory: port code to new buffer data API 2011-03-28 20:08:45 +02: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
Stefan Kost
41e00e58e7 queue2: remove var only used for debug statement 2010-09-23 15:12:32 +03:00
Wim Taymans
2d1450d777 queue2: only post buffering message when percent changed 2010-09-15 13:29:52 +02:00
Wim Taymans
e3176a31e9 queue2: always update buffering status
Update the buffering status even when we are not using a queue so that EOS can
properly finish the buffering.
2010-09-15 13:15:19 +02:00
Philippe Normand
410ca5c164 queue2: buffering_ranges query support
Fixes bug 623121
2010-09-03 19:59:28 +02:00
Sebastian Dröge
2e6f80bf81 elements: Stop using GST_FLOW_IS_FATAL() 2010-08-27 16:59:09 +02:00
Wim Taymans
77f806bf9f queue2: fix on-disk buffering again 2010-08-26 17:04:20 +02:00
Edward Hervey
cc4b33ffdf queue2: Use G_GUINT64_FORMAT where needed
Fixes build on macosx
2010-08-19 09:58:55 +02:00
Wim Taymans
bb45ff49a9 queue2: fix compilation 2010-08-13 16:38:59 +02:00
Robert Swain
dec12cb2b8 queue2: Fix a special case during range management
When a range contained no data, if it was new or newly empty, it would
be mishandled if it were the current range.
2010-08-13 16:38:58 +02:00
Robert Swain
414911b90a queue2: fix locking around init_ranges
This fixes a segfault where the ready to paused state change causes
freeing and allocation of new ranges while another thread is trying to
use them.
2010-08-13 16:38:58 +02:00
Robert Swain
0182c0d88b queue2: More ring buffer fixes
- Set reading_pos correctly in _create_read ()
- Seek to data if it is further than QUEUE_MAX_BYTES (queue) -
  cur_level.bytes away. This should avoid a situation where the ring
  buffer is full but the data offset from which we shall read is not in
  the ring buffer.
- Only update the max_reading_pos to a lower value to protect data when
  necessary
- Always signal an ADD in _locked_enqueue () so that an EOS unlocks the
  reader
- More useful debug output
2010-08-13 16:38:58 +02:00
Robert Swain
c78996a313 queue2: ring buffer fixes
One must not affect the values of the current range based on a read
request before the correct range is activated.
2010-08-13 16:38:58 +02:00
Robert Swain
602f4774c7 queue2: Fix bugs
update_buffering () needs to be called every time we write to the ring
buffer so that applications don't get stuck waiting for a 100% buffered
message while queue2 is waiting for space

_create_write () must only be called for temp file/ring buffer cases
2010-08-13 16:38:57 +02:00
Robert Swain
9df54eb4ff queue2: extend ring buffer to support ram mode 2010-08-13 16:38:57 +02:00
Robert Swain
e29cca10a4 queue2: merge write buffer functions and fix bugs
Cached data could have been overwritten so it is now protected until
it is read. Similarly data was overread as _have_data () was always
looking for the originally requested data even if part of it had been
read already.
2010-08-13 16:38:57 +02:00
Wim Taymans
04f1572ea2 queue2: small cleanup 2010-08-13 16:38:56 +02:00
Wim Taymans
695da33ef5 queue2: cleanup write_to_ring_buffer
Use cur_level.bytes to see how much space is free in the ringbuffer.
Simplyfy the write function, avoid taking subbuffers, move waiting for free
space in one spot, use simply counter to write data of a buffer.
2010-08-13 16:38:56 +02:00
Wim Taymans
abc9ab1747 queue2: cleanups
Add a macro to get the max size of the queue in bytes, which depends on the
max_level.bytes and the ring_buffer_max_size.
Some cleanups.
2010-08-13 16:38:56 +02:00
Wim Taymans
ecd8d3be3a queue2: remove unused variable 2010-08-13 16:38:56 +02:00
Wim Taymans
4478c90642 queue2: cleanups
Make sure the cur_level.bytes is updated after we change the writing_pos or the
max_reading_pos.
Refactor get_free_space()
Add some comments
2010-08-13 16:38:55 +02:00
Wim Taymans
aec4ea0bfe queue2: remove unneeded signal 2010-08-13 16:38:55 +02:00
Wim Taymans
7de963c0e0 queue2: set buffering mode correctly 2010-08-13 16:38:55 +02:00
Wim Taymans
cb6d9b071e queue2: fix calculation of available ringbuffer data 2010-08-13 16:38:55 +02:00
Wim Taymans
8de7cc2222 queue2: reading_pos is updated in create_read only 2010-08-13 16:38:54 +02:00
Wim Taymans
cda4967839 queue2: refactor and add debug 2010-08-13 16:38:54 +02:00
Wim Taymans
117d12f325 queue2: fix flushing 2010-08-13 16:38:54 +02:00
Wim Taymans
e037dd37ae queue2: add debug 2010-08-13 16:38:53 +02:00
Wim Taymans
e882e1b533 queue2: don't try to write 0 bytes 2010-08-13 16:38:53 +02:00
Wim Taymans
73e27fb017 queue2; cleanups and fixes
Make a macro for some frequent checks
Emit the removed signal in all cases when we remove something
2010-08-13 16:38:53 +02:00
Wim Taymans
6339bd0bec queue2: refactorings
Check and handle seek errors
Refactor the wait_free_space function.
2010-08-13 16:38:53 +02:00
Robert Swain
c847b981f4 queue2: Use ring-buffer-max-size prop to control ring buffer 2010-08-13 16:38:52 +02:00
Robert Swain
500d6a9986 queue2: Clean up and improve code 2010-08-13 16:38:52 +02:00
Robert Swain
bde816451e queue2: Fix conditions where behaviour should differ between ring
buffer and temp file
2010-08-13 16:38:52 +02:00
Robert Swain
68e2275bb9 queue2: add useful debug messages and fix an assumption in _have_data () 2010-08-13 16:38:51 +02:00
Robert Swain
9d11b3e79e queue2: fix buffering percentage in ring buffer mode 2010-08-13 16:38:51 +02:00
Robert Swain
178821aace queue2: various ring buffer fixes
- make _get_range () emit the del signal once a buffer has been read
- use do {} while (); for wait code as queue is locked and no data could
  have been read in the mean time so it makes no sense to check before
  waiting
- make _is_filled () more robust
2010-08-13 16:38:51 +02:00
Robert Swain
d1809558e5 queue2: ring buffer work in progress 2010-08-13 16:38:51 +02:00
Robert Swain
f093707189 queue2: Add use-ring-buffer and ring-buffer-max-size properties 2010-08-13 16:38:50 +02:00
Robert Swain
dbfcc727ab queue2: add ST-Ericsson copyright 2010-08-13 16:38:50 +02:00
Mark Nauwelaerts
2057cf6d79 queue2: download mode; prevent range corruption due to race
Current range was being updated in the thread performing seek, but as
no locks were kept for a short section, data flow could resume before
current range updated, so data for the new range would be accepted as
from the previous range.

Rather, range should be updated in serialized manner based on
newsegment event.
2010-07-29 17:29:00 +02:00
Wim Taymans
0a84d81901 queue2: fix merging of ranges
When we merge two ranges, don't updata the current range writing_pos with
whereever we were writing earlier in the merged range.  Spotted by bilboed.
2010-06-21 11:41:46 +02:00
Sebastian Dröge
640ce767d2 queue2: Don't ignore failure to open the temporary file location
And immediately leave the state change function on failures.
2010-06-13 16:31:21 +02:00
Wim Taymans
15141b3954 queue2: don't wait for data when EOS
When in download mode and we need to provide data for an offset that we don't
have, also perform a seek to the requested location when we are EOS. The reason
why we shouldn't wait for more data is because after EOS, there simply will be
no more data and we end up waiting forever.

Fixes #620500
2010-06-07 10:19:30 +02:00
Wim Taymans
d970d74842 queue2: add some more debug info 2010-04-09 15:19:12 +02:00
Wim Taymans
db172aaa6f queue2: when EOS we know the duration
When we are EOS, we don't need to do an upstream query for the duration in bytes
because we already know it is the offset of the last written byte.
2010-04-09 13:21:18 +02:00
Wim Taymans
b9ce2133dc queue2: handle write errors
Handle write errors to the temporary download file and post errors when
something went wrong.
2010-03-25 18:43:04 +01:00
Wim Taymans
0b1beba01d queue2: add element query function
Add an element query function that is a little more efficient than the generic
default query handler.
2010-03-25 18:13:02 +01:00
Wim Taymans
49278848d7 queue2: remove fixed FIXME 2010-03-25 18:05:28 +01:00
Wim Taymans
bf1f6969bb queue2: add the buffering percent in BUFFERING query 2010-03-25 17:38:02 +01:00
Wim Taymans
1f34682644 queue2: improve buffer level measurement in download mode
Keep track of the current buffer level in the current range in download mode so
that we post the correct buffering messages.
2010-03-25 17:38:01 +01:00
Wim Taymans
f9c6a0886e queue2: add more info in the buffering query
Add the estimated download time and estimated time left to the buffering query
results along with the estimated download and playback speed.
2010-03-24 19:03:44 +01:00
Wim Taymans
11304c1257 queue2: implement flushing in download buffering
Maintain a separate variable to control src and sink flowreturn values so that
we can unlock the src part without shutting down the sink part.
Add flushing for upstream pull based elements that unblocks our getrange
function. This implements seeking when blocking for more data.
Add some arbitrary threshold before attempting a seek. Add a FIXME for this
because we need to find a sensible threshold based on the input rate.
2010-03-24 19:03:44 +01:00
Philippe Normand
f534e35261 queue2: Fix uninitialized variable compiler warning 2010-03-24 10:57:08 +01:00
Wim Taymans
3f4f5fa59d queue2: implement seeking in download mode
When in download mode and the requested offset is too far away, attempt to do a
seek request to fetch the data.
Keep track of all downloaded parts and merge ranges when needed.

Fixes #600877
2010-03-23 19:28:34 +01:00
Stefan Kost
7937808ac7 docs: prefer short desc from GstElementDetails 2010-02-15 23:12:56 +02:00
Wim Taymans
62e0d976f3 queue2: add some docs to mark new property 2010-01-22 18:00:53 +01:00
Wim Taymans
183ffdc126 queue2: add option to remove the temp-file
Add an option to automatically remove the temp file (TRUE by default). This
should make it possible for the application to keep the temp file by other means
than hardlinking or holding an fd open.

Fixes #607739
2010-01-22 17:58:07 +01:00
Tim-Philipp Müller
745b35e7d4 docs: minor gtk-doc markup fixes 2010-01-20 01:48:56 +00:00
Thiago Santos
1a50186630 queue2: fix printf format
Cast the variable to gint to conform to the printf format used.
It is casted rather than changing the format because the
message is created with a cast to gint too.
2009-11-10 11:55:34 -03:00
Thiago Santos
245089c9bd queue2: avoid crashing due to negative percent
queue2 would crash when using small buffer sizes because
it would overflow when calculating the percentage, resulting
in the buffering GstMessage not being created and trying to be
used. This patch uses a gint64 instead of a gint to do the
percentage math, making it harder to overflow.
2009-11-10 10:10:56 -03:00
Thiago Santos
5c7104c002 queue2: Fix small doc typo 2009-11-10 09:52:30 -03:00
Bastien Nocera
9581e5887c implement buffering-left argument to buffer messages
Using the current fill level of the queue, and the average input
rate, we can determine how long it will take to finish downloading
the whole stream to the temporary file.

Fixes #600726
2009-11-05 15:22:35 +01:00
Sebastian Dröge
22fbce48bb queue2: Use "Queue 2" as long name 2009-10-29 11:38:21 +01:00
Sebastian Dröge
0f1c4ab188 queue2: Use GST_BOILERPLATE_FULL() and add pad templates/set details in base_init 2009-10-29 11:35:08 +01:00
Sebastian Dröge
5c821a0df5 queue2: Use gst_element_class_set_details_simple() 2009-10-29 11:30:57 +01:00
Sebastian Dröge
40732dd308 queue2: Integrate into coreplugins 2009-10-29 11:30:11 +01:00
Sebastian Dröge
08e3cb531c queue2: Move struct declarations to a separate header 2009-10-29 11:21:36 +01:00
Sebastian Dröge
9236921a34 queue2: Move queue2 to gstreamer coreplugins
Fixes bug #599996.
2009-10-29 11:18:20 +01:00
Renamed from gst/playback/gstqueue2.c (Browse further)