Commit graph

3214 commits

Author SHA1 Message Date
Jan Schmidt 867bfb840e baseparse: Don't return more data than asked for in pull_range()
Even when pulling a new 64KB buffer from upstream, don't return
more data than was asked for in the pull_range() method and then
return less later, as that confused subclasses like h264parse.

Add a unit test that when a subclass asks for more data, it always
receives a larger buffer on the next iteration, never less.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/530

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/733>
2021-01-13 11:25:58 +00:00
Seungha Yang 95c8d8e4b5 check: Use g_thread_yield instead of g_usleep(1)
Since the commit
01c02ac08b,
g_usleep(1) will be translated to Sleep(1) on Windows which means
sleep in 1 millisecond. But GLib provides g_thread_yield() API
which is exactly what we required here for thread context switching.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/644>
2020-09-24 22:28:12 +00:00
Mathieu Duponchelle eed0e22020 aggregator: fix iteration direction in skip_buffers
Subclasses use the pad segment to determine whether a buffer
should be skipped, we thus don't want to check if a buffer
needs to be skipped before processing the segment it's part
of.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/646>
2020-09-24 18:30:43 +00:00
Jan Schmidt 177d0fa1c2 baseparse: Fix upstream read caching
When running in pull mode (for e.g. mp3 reading),
baseparse currently reads 64KB from upstream, then mp3parse
consumes typically around 417/418 bytes of it. Then
on the next loop, it will read a full fresh 64KB again,
which is a big waste.

Fix the read loop to use the available cache buffer first
before going for more data, until the cache drops to < 1KB.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/518
2020-06-07 00:47:41 +01:00
Jan Schmidt 0f91868ef0 baseparse: Fix typo 2020-06-07 00:47:41 +01:00
Matthew Waters d1c887bc77 basetransform: allow not passthrough if generate_output is implemented
This allows an element to not require implementing transform or
transform_ip.
2020-03-13 14:37:58 +00:00
Matus Gajdos ba43993f24 baseparse: fix memory leak
A buffer to be skipped wasn't unref'd in gst_base_parse_chain().

Fixes #406
2020-02-15 19:16:42 +00:00
Zebediah Figura b52c8fc2b2 baseparse: Set the private duration before posting a duration-changed message
Otherwise an application cannot rely on a subsequent call to e.g. gst_pad_query_duration() succeeding.
2020-02-15 00:14:10 +00:00
Tim-Philipp Müller 090a928329 meson: fix warning about configure_file() install kwarg
The install kwarg on configure_file() was only added in
Meson 0.50 but we're targetting older versions as well,
which caused a warning. The install kwarg is not needed
here as we specify install_dir, so we can just drop it.

Fixes #379
2019-08-15 14:16:51 +01:00
Sebastian Dröge 549cc941eb aggregator: Actually handle NEED_DATA return from update_src_caps()
The documentation says that this allows the subclass to signal that it
needs more data before it can decide on caps, so let's actually
implement it that way.
2019-08-14 14:49:53 +01:00
Sebastian Dröge 5bf13cdd53 aggregator: Assert if the sink/src pad type that is to be used is not a GstAggregatorPad or subclass thereof 2019-08-14 13:35:31 +01:00
Sebastian Dröge 8f3fa68504 aggregator: Ensure that the source pad is created as a GstAggregatorPad if no type is given in the pad template
Otherwise we would create a GstPad and that causes invalid memory
accesses later.
2019-08-14 13:35:31 +01:00
Sebastian Dröge 99aeb91cc0 aggregator: Make parsing of explicit sink pad names more robust
When passing "sink_%d" twice to aggregator before it would create two
pads called "sink_0", because it failed to parse "%d" as integer and
used 0 instead then.

Instead validate that parsing was actually successful and also don't
even try to parse if the requested pad name contains a '%'.
2019-08-08 21:03:42 +01:00
Tim-Philipp Müller edc1a5be3e aggregator: fix flow-return boolean return type mismatch
Not that it matters, since we don't check the return value
anyway. Unclear why the aggregator pad flush function should
have a return value at all really, and perhaps it should be
called reset anyway. Spotted by dv on irc.
2019-08-08 11:05:53 +01:00
Michael Olbrich 6a331c4e4d meson: set correct install path for gdb helper
The original version of the patch used glib-2.0 but that was later changed
to gstreamer-1.0 for autotools. The meson file was forgotten.

Fix the path to match the one used in libgstreamer-gdb.py.in.
2019-08-07 20:39:38 +01:00
Sebastian Dröge 124ed4d363 base: Include gstbitwriter.h in the single-include header 2019-08-06 23:35:46 +01:00
Sebastian Dröge 68645e1e9b bitwriter: Fix inclusion of header in C++ code
../subprojects/gstreamer/libs/gst/base/gstbitwriter.h: In function 'gboolean _gst_bit_writer_check_remaining(GstBitWriter*, guint32)':
../subprojects/gstreamer/libs/gst/base/gstbitwriter.h:161:31: error: invalid conversion from 'gpointer' {aka 'void*'} to 'guint8*' {aka 'unsigned char*'} [-fpermissive]
   bitwriter->data = g_realloc (bitwriter->data, (new_bit_size >> 3));
                     ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-08-06 23:35:46 +01:00
Sebastian Dröge 62296b2bad bitwriter: Mark the whole type as Since: 1.16 2019-08-06 16:00:11 +01:00
Sebastian Dröge a1eb31afb1 aggregator: Mark all public structs as Since: 1.14 2019-08-06 16:00:11 +01:00
Sebastian Dröge e749ad0ecf libs: Fix various Since markers 2019-08-06 16:00:11 +01:00
Olivier Crête 61f2d9b07a basesrc: Downgrade EOS warning
In the case of pushfilesrc, this is the expected behaviour, so let's
downgrade the warning to a debug message to avoid confusing users.
2019-04-18 13:55:47 +00:00
Tim-Philipp Müller 41f873fa0a aggregator: fix doc chunk for new buffer-consumed signal
Fixes 'Warning: GstBase: incorrect number of parameters in
comment block, parameter annotations will be ignored.' from
g-ir-scanner.
2019-04-16 23:51:19 +01:00
Mathieu Duponchelle fee108f7cf basesrc: do not send EOS when automatic_eos is FALSE 2019-04-05 18:00:29 +00:00
Mathieu Duponchelle ae57b1c76d aggregator: add buffer-consumed pad signal
The signal will be emitted when a buffer was consumed on
a pad, if the newly-added "emit-signals" property has been
set to TRUE.

Handlers connected to the signal will receive a valid reference on
the consumed buffer, allowing for example the retrieval of metas in
order to forward them once an output buffer is pushed out.
2019-04-05 12:13:54 +00:00
Tim-Philipp Müller 93d190b5b3 check: suppress some g-i warnings
gstcheck.c:142: Warning: GstCheck: gst_check_add_log_filter: return value: Invalid non-constant return of bare structure or union; register as boxed type or (skip)
gstcheck.h:178: Warning: GstCheck: gst_check_run_suite: argument suite: Unresolved type: 'Suite*'
2019-03-23 18:17:43 +00:00
Tim-Philipp Müller cef902814d bitwriter: mark as 'skip' for gobject-introspection
Silences g-ir-scanner warnings. We do the same for ByteWriter.
2019-03-23 17:53:07 +00:00
Matthew Waters c6691abba1 aggregator: don't leak gap buffer when out of segment 2019-03-21 19:18:46 +11:00
Matthew Waters 619dfc91bb aggregator: take the pad lock around queue gap event removal
As is done for every other queue interaction
2019-03-21 19:18:46 +11:00
Matthew Waters b8d00b9e6e baseparse: don't reset the disable-passthrough property value
Resetting as a result of _reset() on PAUSED->READY is unexpected.
2019-03-20 17:44:30 +11:00
Nirbheek Chauhan febfabb39f misc: Fix various compiler warnings on MinGW
gstharness.c: Use G_GSIZE_FORMAT instead of hard-coding %zu
error: unknown conversion type character 'z' in format [-Werror=format]

gst-inspect.c: GPid is void* on non-UNIX, and we only use it on UNIX
error: initialization makes pointer from integer without a cast [-Werror]

gstmeta.c: Use and then discard value
error: value computed is not used [-Werror=unused-value]

With this, gstreamer builds with -Werror on MinGW
2019-02-05 18:45:54 +05:30
Tim-Philipp Müller 41d5f22334 aggregator: fix typo in docs 2019-01-05 18:55:12 +00:00
Michael Olbrich c5b85da8ef gdb: implement 'gst-dot' and 'gst-print' commands
This adds two custom gdb commands:

'gst-dot' creates dot files that a very close to what
GST_DEBUG_BIN_TO_DOT_FILE() produces. Object properties and buffer content
(e.g. codec-data in caps) are not available.

'gst-print' produces high-level information about GStreamer objects. This
is currently limited to pads for GstElements and events for the pads. The
output can look like this:

(gdb) gst-print pad.object.parent
GstMatroskaDemux (matroskademux0) {
    SinkPad (sink, pull) {
    }
    SrcPad (video_0, push) {
      events:
        stream-start:
          stream-id: 0463ccb080d00b8689bf569a435c4ff84f9ff753545318ae2328ea0763fd0bec/001:1274058367
        caps: video/x-theora
          width: 1920
          height: 800
          pixel-aspect-ratio: 1/1
          framerate: 24/1
          streamheader: < 0x5555557c7d30 [GstBuffer], 0x5555557c7e40 [GstBuffer], 0x7fffe00141d0 [GstBuffer] >
        segment: time
          rate: 1
        tag: global
          container-format: Matroska
    }
    SrcPad (audio_0, push) {
      events:
        stream-start:
          stream-id: 0463ccb080d00b8689bf569a435c4ff84f9ff753545318ae2328ea0763fd0bec/002:1551204875
        caps: audio/mpeg
          mpegversion: 4
          framed: true
          stream-format: raw
          codec_data: 0x7fffe0014500 [GstBuffer]
          level: 2
          base-profile: lc
          profile: lc
          channels: 2
          rate: 44100
        segment: time
          rate: 1
        tag: global
          container-format: Matroska
        tag: stream
          audio-codec: MPEG-4 AAC audio
          language-code: en
    }
}
2018-12-31 16:19:05 +00:00
Michael Olbrich e43a0c9943 gdb: make the code PEP-8 compliant 2018-12-31 16:19:05 +00:00
Tim-Philipp Müller 33267b2ecc basesrc: ensure submitted buffer list is writable
Fixes flaky appsrc unit test where depending on scheduling
the submitted list might not be writable if submitted via
an action signal from the application thread.

Fixes gst-plugins-base#522
2018-12-19 00:34:40 +00:00
Edward Hervey 34b02908c7 harness: assert on result of gst_pad_push_event()
That assertion was accidentally removed in the refactoring done in
60de1f26c7
2018-12-15 11:07:21 +01:00
Roman Sivriver c9e2057ec6 gst: fixed the install command for gdb python macros on macos - install -D is not supported by BSD install 2018-12-06 20:22:21 +00:00
KimTaeSoo bf1979e55f baseparse: Use buffer from short reads instead of pulling again
baseparse internally uses a 64kb buffer for pulling data from upstream.
If a 64kb pull is failing with a short read, it would previously pull
again the requested size.

Doing so is not only inefficient but also seems to cause problems with
some elements (rawvideoparse) where the second pull would fail with EOS.

Short reads are only allowed in GStreamer at EOS.

Closes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/294
2018-11-28 17:38:58 +02:00
Jordan Petridis 84512152c1
Run gst-indent through the files
This is required before we enabled an indent test in the CI.

https://gitlab.freedesktop.org/gstreamer/gstreamer-project/issues/33
2018-11-28 05:58:53 +02:00
Mathieu Duponchelle f83b8ab701 Revert "harness: Take ownership of floating references (pads, elements) passed to the harness"
This reverts commit 2faf93c009.

THis broke half our unit tests, oops:

https://ci.gstreamer.net/job/GStreamer-master/11203/testReport/
2018-11-27 02:59:41 +01:00
Sebastian Dröge 2faf93c009 harness: Take ownership of floating references (pads, elements) passed to the harness
Without this bindings get confused about the meaning of references, and
we really own these references if they are not already owned by
something else.
2018-11-26 17:03:23 +00:00
Havard Graff 1335110409 tests: fix tests when compiling with glib_checks=disabled
We won't be able to do ASSERT_CRITICAL, but the main body of the tests
are still valid, and given we ship GStreamer with this configuration, it
is important to be able to run some tests against it.
2018-11-10 15:37:36 +00:00
Tim-Philipp Müller b92e34ebfd Fix distcheck
Follow-up to !18 and #320.
2018-11-08 14:09:32 +00:00
Michael Olbrich bc621cc335 gst: add some gdb python macros
This adds gdb pretty printer for some GStreamer types.
For GstObject pointers the type and name is added, e.g.
"0x5555557e4110 [GstDecodeBin|decodebin0]".
For GstMiniObject pointers the object type is added, e.g.
"0x7fffe001fc50 [GstBuffer]".
For GstClockTime and GstClockTimeDiff the time is also printed in human
readable form, e.g. "150116219955 [+0:02:30.116219955]".

Fixes #320
2018-11-08 12:36:23 +00:00
Havard Graff fa34768729 harness: improve _wait_for_clock_id_waits performance
By moving the functionality down to the testclock, the implementation
no longer needs to poll the waits, but rather wait properly for
them to be added.

The performance-hit here would be that by polling the test-clock
regularly, you would create contention on the testclock-lock, making code
using the testclock (gst_clock_id_wait) fighting for the lock.
2018-11-06 11:46:06 +01:00
Thomas Bluemel 36ab067905 clock: Keep weak reference to underlying clock
Fixes potential segmentation fault when using a GstClockID that
is referencing an already freed GstClock

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/187
2018-11-03 19:00:22 +02:00
Sebastian Dröge c3214e8deb harness: Add API for proposing meta APIs from the allocation query
https://bugzilla.gnome.org/show_bug.cgi?id=797350
2018-10-28 17:05:27 +00:00
Sebastian Dröge fc3602aec8 queuearray: Only clear dropped item if it is not returned 2018-10-15 18:47:16 +03:00
Sebastian Dröge 2481e542c7 queuearray: Clear items when dropping them and a clear function was defined 2018-10-15 15:28:35 +03:00
Jan Schmidt 04176bede1 ptp clock: Wait for ANNOUNCE before selecting a master
Previously, with opportunistic sync we'd track a master
clock as soon as we see a SYNC message, and hence sync up
faster, but then we'd announce we're synched before seeing
the ANNOUNCE, leaving the clock details like grandmaster-clock
empty.

A better way is to start tracking the clock opportunistically,
but not announce we're synched until we've also seen the ANNOUNCE.
2018-10-11 22:11:51 +11:00
Jan Schmidt d37fcea225 ptp clock: improve debug
Log message arrival times. Fix a typo in one debug string
2018-10-11 22:11:51 +11:00