Commit graph

2032 commits

Author SHA1 Message Date
Anton Bondarenko f468eb7db0 filesink: continue element cleanup even if fclose fails
Sometimes filesink cleanup during stop may fail due to fclose error.
In this case object left partial cleanup with no file opened
but still holding old file descriptor.

It's not possible to change location property in a such state,
so next start will cause old file overwrite if 'append' does not set.

According to man page and POSIX standard about fclose behavior(extract):
------------------------------------------------------------------------
The fclose() function shall cause the stream pointed to by stream
to be flushed and the associated file to be closed.
...
Whether or not the call succeeds, the stream shall be disassociated
from the file and any buffer set by the setbuf() or setvbuf()
function shall be disassociated from the stream.
...
The fclose() function shall perform the equivalent of a close()
on the file descriptor that is associated with the stream
pointed to by stream.

After the call to fclose(), any use of stream results
in undefined behavior.
------------------------------------------------------------------------

So file is in 'closed' state no matter if fclose succeed or not.
And cleanup could be continued.

https://bugzilla.gnome.org/show_bug.cgi?id=757596
2015-11-05 10:17:41 +01:00
Thiago Santos cf5e7c03c2 stats: log the element-new hook properly
To be able to get the time the elements were created instead of
just logging them without a time
2015-10-29 07:27:35 -03:00
Edward Hervey a9c923d585 queue/queue2: Use GST_BUFFER_DTS_OR_PTS
The input of queue/queue2 might have DTS set, in which cas we want
to take that into account (instead of the PTS) to calculate position
and queue levels.

https://bugzilla.gnome.org/show_bug.cgi?id=756507
2015-10-27 08:49:02 +01:00
Edward Hervey 692c0dc060 multiqueue: Use buffer DTS if present, else PTS
In order to accurately determine the amount (in time) of data
travelling in queues, we should use an increasing value.

If buffers are encoded and potentially reordered, we should be
using their DTS (increasing) and not PTS (reordered)

https://bugzilla.gnome.org/show_bug.cgi?id=756507
2015-10-27 08:38:42 +01:00
Edward Hervey 7c8f76a39f multiqueue: Improve incoming SEGMENT handling
Previously this code was just blindly setting the cached flow return
of downstream to GST_FLOW_OK when we get a SEGMENT.

The problem is that this can not be done blindly. If downstream was
not linked, the corresponding sinqlequeue source pad thread might be
waiting for the next ID to be woken up upon.

By blindly setting the cached return value to GST_FLOW_OK, and if that
stream was the only one that was NOT_LINKED, then the next time we
check (from any other thread) to see if we need to wake up a source pad
thread ... we won't even try, because none of the cached flow return
are equal to GST_FLOW_NOT_LINKED.

This would result in that thread never being woken up

https://bugzilla.gnome.org/show_bug.cgi?id=756645
2015-10-19 14:31:05 +02:00
Edward Hervey 14ad763698 multiqueue: Accept STREAM_START after EOS
In the same way core now allows STREAM_START to remove the flushing
state from pads, we need to do the same thing in multiqueue
2015-10-15 17:21:40 +02:00
Sebastian Dröge 2b8413e1cd tracers: Only link against libgstprintf.la if the debugging system is enabled
It does not exist otherwise and linking will fail.
2015-10-07 12:01:16 +01:00
Stefan Sauer d626c5b996 Revert "tracers: Only build getrusage() tracer if RUSAGE_THREAD is available"
This reverts commit 8ddbf76626.
2015-10-07 12:22:34 +02:00
Stefan Sauer 03045d428b tracers/rusage: ifdef the RUSAGE_THREAD usage
Some versions of andoid don't seem to have it.
2015-10-07 12:21:56 +02:00
Sebastian Dröge 8ddbf76626 tracers: Only build getrusage() tracer if RUSAGE_THREAD is available 2015-10-07 11:13:28 +01:00
Stefan Sauer 03821d18a0 tracers: disable the log tracer if debug logging is disabled 2015-10-06 18:46:24 +02:00
Stefan Sauer 34cf8f3252 makefile.am: Remove obsolete Android build cruft
This is not needed any longer.
2015-10-06 18:45:41 +02:00
Thiago Santos 7c5f7173c8 tracers: stats: add message structure to output
The name of the message is not enough. For example, state-change
is not enough to know the transition.

https://bugzilla.gnome.org/show_bug.cgi?id=754496
2015-10-05 19:06:41 -03:00
Thiago Santos 0913f699e2 tracer: gststats: add thread-id to log line 2015-10-05 20:59:39 +02:00
Thiago Santos 567865c81c tracer: add pad query hooks 2015-10-05 20:59:39 +02:00
Mathieu Duponchelle a9aab3c6c7 tracer: Use GST_TIME_ARGS when printing with GST_TIME_FORMAT. 2015-10-05 20:59:39 +02:00
Stefan Sauer e5eb05741b stats: TIMESTAMP -> PTS 2015-10-05 20:59:39 +02:00
Stefan Sauer 660049bb38 tracing: rename the global api to gst_tracing
This makes it more obvious what is the api for tracer elements and what is api
for the global state.
2015-10-05 20:59:39 +02:00
Stefan Sauer 5e2770566f tracers: eliminate var_args
Register tracer hooks as GCallback. Use macros for hook dispatch and cast the
hook functions back to the appropriate type.
2015-10-05 20:59:39 +02:00
Stefan Sauer b10b10cf1e tracers: code cleanups
Move static variables to instance variables. Add finalize methods. Remove code
that is commented out. Cleanup locking code.
2015-10-05 20:59:39 +02:00
Stefan Sauer 4881d1c16c tracer: use GQuark or strings for the hook id
This way one can define new tracing probes without changing the core. We are
using our own quark table, as 1) we only want to initialize them if we're
tracing, 2) we want to share them with the tracers.
2015-10-05 20:59:39 +02:00
Stefan Sauer 1a3e218b89 tracer: simplify hook api
Instead of a single invoke() function and a 'mask', register to individual
hooks. This avoids one level of indirection and allows us to remove the
hook enums. The message enms are now renamed to hook enums.
2015-10-05 20:59:39 +02:00
Stefan Sauer 7b24d76260 tracer: drop the HookId hid from the invoke method
The MessageId is more detailed and anyway needed to interpret the varargs.
2015-10-05 20:59:39 +02:00
Stefan Sauer 4ab1e6e3f7 stats: fixup doc name and remove commented code 2015-10-05 20:59:39 +02:00
Stefan Sauer 4f6f8cb811 tracers: add metadata for the logged values 2015-10-05 20:59:39 +02:00
Stefan Sauer 3baaa4ba6f rusage: improve cpu load meassurements
Get the number of cpus and scale process cpu-load accordingly. Switch the
cpuload to be per-mille to get smoother graphs. Add a bit more logging and use
the _OBJECT variant.
2015-10-05 20:59:39 +02:00
Stefan Sauer dbb1897e9b rusage: implement windowing of cpuload
Add a local help to the rusage plugin that supports windowing of values. We want
to generalize this for use in other plugins.
2015-10-05 20:59:39 +02:00
Stefan Sauer 018858980b rusage: announce the data format
Rusage will now announce what is meassures and how it is logged. Use the new format in stats.
Cleanup the the code and naming.
2015-10-05 20:59:39 +02:00
Stefan Sauer c13ee1f2e9 stats: improve cpu load meassurements
Rename variables for clarity. Handle the initial disparity between debug time
and the time already spent in the proc and main thread.
2015-10-05 20:59:39 +02:00
Stefan Sauer 46ea9729df tracer: split into tracer and tracerutils
Keep tracer base class in tracer and move core support into the utils module.
Add a unstable-api guard to the tracer.h so that external modules would need to
acknowledge the status by setting GST_USE_UNSTABLE_API.
2015-10-05 20:59:39 +02:00
Stefan Sauer 6ea2b41364 docs: add gtk-doc blobs 2015-10-05 20:59:39 +02:00
Stefan Sauer 757d3400cd latency: take stop time when buffer is handled
Now we meassure time from 'before buffer transfer on src' to when the 'buffer is processed on sink'.
2015-10-05 20:59:39 +02:00
Stefan Sauer 7dfc0a8ead tracers: add a logging helper to remove identical copies from the tracers 2015-10-05 20:59:39 +02:00
Stefan Sauer 635a4b5c00 tracers: tweak the get_real_pad_parent()
By using the we ended up on the actual element, not the parent.
2015-10-05 20:59:39 +02:00
Stefan Sauer 111b18115a tracers: add a new latency tracer
Add a new tracer with pushes extra events to meassure src-to-sink processing latency.
2015-10-05 20:59:39 +02:00
Stefan Sauer fc9392c10f rusage: add a new rusage tracer
The tracer hooks up to all probes and logs resource usage figures.
2015-10-05 20:59:39 +02:00
Stefan Sauer 0c26387e62 stats: improve the handling of parentage
Log new object after we did the check for parents.
2015-10-05 20:59:39 +02:00
Stefan Sauer b8eef6ba2c stats: add a stats frontend
Parse the log and collect data from tracer messages.
2015-10-05 20:59:39 +02:00
Stefan Sauer ac92e5674e log: add query log category 2015-10-05 20:59:39 +02:00
Stefan Sauer ce7ce2d866 tracer: add more hooks and handle it in the plugins 2015-10-05 20:59:39 +02:00
Stefan Sauer 37721fdc9d stats: handle buffer lists 2015-10-05 20:59:39 +02:00
Stefan Sauer 75fb1f1a73 log: make the log tracer more verbose again
Define log formats per message type and print details.
2015-10-05 20:59:39 +02:00
Stefan Sauer 11d6e13d73 tracer: use a macros for the enabled check
Avoid a function call and check the variables from the macro.
2015-10-05 20:59:39 +02:00
Stefan Sauer 9d3975b5da tracer: pass the timestamp directly
Avoid the structure mashalling (and weird field naming).
2015-10-05 20:59:39 +02:00
Stefan Sauer d663b78612 stats: add a tracer that collects pipeline statistics
This is more or less equiv to the the statistics in gst-tracelib.
2015-10-05 20:59:39 +02:00
Stefan Sauer 2c6672435f log: add cast macro 2015-10-05 20:59:39 +02:00
Stefan Sauer c2d5b35332 tracer: pass the instance to the vmethod 2015-10-05 20:59:39 +02:00
Stefan Sauer 8a8f16863b design: more planning 2015-10-05 20:59:39 +02:00
Stefan Sauer 68b1473846 tracer: add the hook-id to the invoke signature
Tracers that subscribe to multiple hooks can know what hook was used.
2015-10-05 20:59:39 +02:00
Stefan Sauer 4e5d586c7d tracer: initial prototype for the tracing subsystem 2015-10-05 20:59:39 +02:00