Commit graph

268 commits

Author SHA1 Message Date
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
Tim-Philipp Müller
a63829b4ff plugins: use new gst_element_class_set_static_metadata() 2012-04-09 13:05:07 +01:00
Tim-Philipp Müller
4348851cd9 Merge remote-tracking branch 'origin/0.10'
Conflicts:
	gst/gstatomicqueue.c
2012-04-07 15:42:08 +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
d5d0d10979 queue2: fix for merged changes 2012-04-06 12:42:39 +02:00
Wim Taymans
fb8fbdaeb3 Merge branch '0.10' 2012-04-06 12:37:41 +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
0ba0f7cd5b Merge branch '0.10'
Conflicts:
	plugins/elements/gstqueue2.c
2012-04-05 10:36:08 +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
Wim Taymans
f9c85a53dc pad: improve docs of get/pull_range
Improve the docs of the get/pull_range functions, define the lifetime of the
buffer in case of errors and short reads.
Make sure the code does what the docs say.
2012-03-20 13:14:55 +01:00
Wim Taymans
85c9543841 memory: group allocation parameters in a struct
Group the extra allocation parameters in a GstAllocationParams structure to make
it easier to deal with them and so that we can extend them later if needed.
Make gst_buffer_new_allocate() take the GstAllocationParams for added
functionality.
Add boxed type for GstAllocationParams.
2012-03-15 13:42:17 +01:00
Wim Taymans
0addca0810 queue: remove useless PROXY_ALLOCATION flag 2012-03-15 13:42:12 +01:00
Wim Taymans
9e2ef19dc2 queues: warn when receiving a serialized event
.. until we implement it.
2012-03-14 16:00:48 +01:00
Wim Taymans
7ab1d62c24 GST_FLOW_WRONG_STATE -> GST_FLOW_FLUSHING 2012-02-08 16:18:04 +01:00
Wim Taymans
87b805a639 plugins: proxy allocation query 2012-02-02 12:32:07 +01:00
Wim Taymans
fe9e284463 queue2: fix memory leak
unmap the buffer memory on errors.
2012-01-27 15:33:48 +01:00
Sebastian Dröge
eba7fed1d3 queue2: Fix handling of the new stream-start event 2012-01-27 12:33:56 +01:00
Wim Taymans
a521252845 Add new GstMapInfo
Use a structure to hold info about the mapping. The application then keeps track
of this state and we can use it to unmap the memory again later.
2012-01-25 11:54:23 +01:00
Wim Taymans
252327f87a Update for new gthread API 2012-01-19 09:27:04 +01:00
Wim Taymans
0f6ca2afe4 queue2: unmap with the right data pointer
Use the original data pointer to unmap the buffer memory.
2012-01-06 13:06:32 +01:00
Tim-Philipp Müller
a1daf846f3 Merge remote-tracking branch 'origin/master' into 0.11
Conflicts:
	gst/gstobject.h
	libs/gst/check/gstcheck.h
	libs/gst/controller/gstcontroller.c
	plugins/elements/gstidentity.c
	tools/gst-xmlinspect.c
2011-12-04 15:38:09 +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
Tim-Philipp Müller
e3dd1a8196 queue2: fix up comment after merge from 0.10 2011-11-28 01:12:48 +00:00
Tim-Philipp Müller
5acdc22001 Merge remote-tracking branch 'origin/master' into 0.11 2011-11-28 01:11:47 +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
6ed2b05157 queue2: fix up new bufferlist code for 0.11 2011-11-28 01:00:28 +00:00
Tim-Philipp Müller
17ddbc3072 Merge remote-tracking branch 'origin/master' into 0.11
Conflicts:
	plugins/elements/gstqueue2.c
2011-11-28 00:40:55 +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
Matej Knopp
6ea74a0572 Fix printf format compiler warnings on OSX/64bit
https://bugzilla.gnome.org/show_bug.cgi?id=664491
2011-11-22 00:51:06 +00:00
Wim Taymans
2f1ed65339 pad: Merge pad mode activation functions
Add the pad mode to the activate function so that we can reuse the same function
for all activation modes. This makes the core logic smaller and allows for some
elements to make their activation code easier. It would allow us to add more
scheduling modes later without having to add more activate functions.
2011-11-21 13:29:05 +01:00
Wim Taymans
770159fb1c query: improve scheduling query
Turns some boolean arguments in the scheduling query to flags, which are easier
to extend and makes the code easier to read.
Make extra methods for configuring and querying the supported scheduling modes.
This should make it easier to add new modes later.
2011-11-18 17:27:16 +01:00
Wim Taymans
39a5e26ea9 pad: add parent to activate functions 2011-11-18 13:54:29 +01:00
Wim Taymans
612b1fbb14 pad: add parent to other functions
Add parent to chain, chain_list, getrange and event functions.
2011-11-17 12:40:45 +01:00
Wim Taymans
09a8294d36 pad: add parent to the query function 2011-11-16 17:22:56 +01:00
Wim Taymans
54e1174060 GstPadFlags: rename flags GST_PAD_* -> GST_PAD_FLAG_* 2011-11-16 12:36:51 +01:00
Wim Taymans
06d4828df3 plugins: remove obsolete parent checks 2011-11-16 12:11:12 +01:00
Wim Taymans
e85198bc32 _query_peer_*() -> _peer_query_*() 2011-11-15 17:50:34 +01:00
Wim Taymans
b5c3e254b1 pad: remove getcaps and use caps query
Remove the getcaps function on the pad and use the CAPS query for
the same effect.
Add PROXY_CAPS to the pad flags. This instructs the default caps event and query
handlers to pass on the CAPS related queries and events. This simplifies a lot
of elements that passtrough caps negotiation.
Make two utility functions to proxy caps queries and aggregate the result. Needs
to use the pad forward function instead later.
Make the _query_peer_ utility functions use the gst_pad_peer_query() function to
make sure the probes are emited properly.
2011-11-15 11:20:48 +01:00
Wim Taymans
b7966c0c7d pad: make an ACCEPT_CAPS query
Replace the acceptcaps function with a query.
2011-11-09 17:36:00 +01:00
Wim Taymans
c2c9776027 Merge branch 'master' into 0.11
Conflicts:
	gst/gstbin.c
2011-11-04 19:11:19 +01:00
Tim-Philipp Müller
cc279e6bdd queue2: use statically allocated GQueue 2011-11-03 22:41:13 +00:00
Wim Taymans
ea012d3dd7 pad: GST_FLOW_UNEXPECTED -> GST_FLOW_EOS 2011-10-10 11:33:51 +02:00
Sebastian Dröge
43538e2e75 Merge branch 'master' into 0.11
Conflicts:
	docs/design/draft-buffer2.txt
	docs/design/part-TODO.txt
	docs/design/part-block.txt
	docs/design/part-bufferlist.txt
	docs/design/part-caps.txt
	docs/design/part-element-transform.txt
	docs/design/part-events.txt
	docs/design/part-negotiation.txt
	gst/gstcaps.c
	gst/gstevent.h
	gst/gstghostpad.c
	gst/gstinterface.c
	gst/gstpad.c
	gst/gstpad.h
	gst/gstutils.c
	libs/gst/base/gstbasesink.c
	libs/gst/base/gstbasesrc.c
	libs/gst/base/gstbasetransform.c
	libs/gst/base/gsttypefindhelper.c
	plugins/elements/gstcapsfilter.c
	plugins/elements/gsttee.c
	tests/check/generic/sinks.c
	tools/gst-launch.1.in
2011-09-08 14:28:23 +02: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
Wim Taymans
e01b5c0f46 Merge branch 'master' into 0.11 2011-08-15 14:43:14 +02: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
Josep Torra
178bdccb76 Fix and clarify debug statements
Fixes build on MacOSX

Signed-off-by: Edward Hervey <edward.hervey@collabora.co.uk>
2011-08-10 11:01:58 +02:00
Tim-Philipp Müller
99742dc57e plugins: update for query API changes 2011-07-28 11:24:19 +01:00
Wim Taymans
b27ee30a35 buffer: make new _buffer_allocate method
Make a new method to allocate a buffer + memory that takes the allocator and the
alignment as parameters. Provide a macro for the old method but prefer to use
the new method to encourage plugins to negotiate the allocator properly.
2011-06-10 13:49:23 +02:00
Wim Taymans
7e6d579301 scheduling: port to new scheduling query 2011-05-24 17:39:56 +02:00
Sebastian Dröge
a46c9c2a62 event: Make SEGMENT event parsing API more consistent with the others 2011-05-18 16:56:43 +02:00
Sebastian Dröge
3d2127f865 Revert "query: allow _make_writable on query handlers"
This reverts commit cf4fbc005c.

This change did not improve the situation for bindings because
queries are usually created, then directly passed to a function
and not stored elsewhere, and the writability problem with
miniobjects usually happens with buffers or caps instead.
2011-05-17 11:21:41 +02:00
Sebastian Dröge
b935a814d9 Merge branch 'master' into 0.11
Conflicts:
	configure.ac
	docs/gst/gstreamer-sections.txt
	gst/gstbin.c
	gst/gstelement.c
	gst/gstelement.h
	gst/gstghostpad.c
	gst/gstminiobject.c
	gst/gstminiobject.h
	libs/gst/base/gstbasesrc.c
	libs/gst/base/gstbasetransform.c
	plugins/elements/gstinputselector.c
	tests/check/gst/gstminiobject.c
2011-05-16 16:53:04 +02:00
Sebastian Dröge
43e165c93c elements: Update for negotiation related API changes
The filter caps are only forwarded and returned instead
of ANY caps in the core elements because they don't do
anything caps specific.
2011-05-16 15:33:11 +02: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
Wim Taymans
bdbc069348 Rework GstSegment handling
Improve GstSegment, rename some fields. The idea is to have the GstSegment
structure represent the timing structure of the buffers as they are generated by
the source or demuxer element.
gst_segment_set_seek() -> gst_segment_do_seek()
Rename the NEWSEGMENT event to SEGMENT.
Make parsing of the SEGMENT event into a GstSegment structure.
Pass a GstSegment structure when making a new SEGMENT event. This allows us to
pass the timing info directly to the next element. No accumulation is needed in
the receiving element, all the info is inside the element.
Remove gst_segment_set_newsegment(): This function as used to accumulate
segments received from upstream, which is now not needed anymore because the
segment event contains the complete timing information.
2011-05-16 11:37:52 +02:00
Wim Taymans
cf4fbc005c query: allow _make_writable on query handlers
Pass a GstQuery ** to the query handlers so that they can make the query
writable before using a setter on it.
Port code to new API.
2011-05-10 18:36:33 +02:00
Wim Taymans
c07b57fc05 segment: remove _full version
Rename the _full versions of the functions to the normal function names.
2011-05-09 17:51:07 +02:00
Wim Taymans
02e5feb2bf pad: avoid using the old GST_PAD_CAPS
Don't use GST_PAD_CAPS but instead use the new gst_pad_get_current_caps()
method.
Avoid setting caps on buffers.
2011-05-06 19:04:54 +02:00
Wim Taymans
c4751ec8c1 Revert "context: use context on buffers instead of caps"
This reverts commit 9ef1346b1f.

Way to much for one commit and I'm not sure we want to get rid of the pad caps
just like that. It's nice to have the buffer and its type in onw nice bundle
without having to drag the complete context with it.
2011-05-05 13:17:08 +02:00
Wim Taymans
9ef1346b1f context: use context on buffers instead of caps
Put the srcpad context on buffers instead of caps. This allows us to associate
all the relevant info contained in events with a buffer.
2011-05-04 18:59:47 +02:00
Wim Taymans
6ab7e6c15d Remove pad_alloc, this can now be done better
Remove pad_alloc and all references. This can now be done more efficiently and
more flexible with the ALLOCATION query and the bufferpool objects. There is no
reverse negotiation yet but that will be done with an event later.
2011-04-29 13:26:19 +02:00
Wim Taymans
7e2a79fa1d queue2: fix mixing of return values 2011-04-25 10:56:06 +02:00
Sebastian Dröge
5020738a6d elements: Use G_DEFINE_TYPE instead of GST_BOILERPLATE 2011-04-19 11:45:36 +02:00
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