After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 341818 - [matroskademux] poor concurrent performance
[matroskademux] poor concurrent performance
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal major
: 0.10.4
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-05-15 08:57 UTC by Jindrich Makovicka
Modified: 2006-05-17 08:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to ebml-read.c (9.53 KB, patch)
2006-05-15 08:58 UTC, Jindrich Makovicka
committed Details | Review

Description Jindrich Makovicka 2006-05-15 08:57:52 UTC
Currently, the ebml reader of the Matroska demuxer (ebml-read.c) makes a heavy use of gst_buffer_create_sub() to extract data from the main buffer. The problem is, that creating and destroying of the subbuffer involve calls to GLib's type identification machinery, and require a serialization using one global mutex.
This is expensive performance-wise, and many concurrent instances of this plugin running, it leads to fatal mutex contention.

The attached patch modifies ebml-read.c to simply use pointers instead of a subbuffer where possible. The gst_ebml_read_peek_bytes() function now accepts two parameters for a return value, GstBuffer ** and guint **, and returns the subbuffer or just a data pointer any of them which is non-null. Inside ebml-read, which does mostly trivial actions, and would discard the subbuffer immediately, the pointers are used exclusively. Outside of ebml-read, the subbuffers are exported as before.

We observed at least a ten-fold performance increase in the terms of concurent streams after this change.
Comment 1 Jindrich Makovicka 2006-05-15 08:58:35 UTC
Created attachment 65481 [details] [review]
Patch to ebml-read.c
Comment 2 Tim-Philipp Müller 2006-05-17 08:13:01 UTC
Indeed, very silly and inefficient code there (left over from when the demuxer was ported to 0.10). Thanks for the patch!

 2006-05-16  Tim-Philipp Müller  <tim at centricular dot net>

        Patch by: Jindrich Makovicka  <jindrich.makivicka at itonis tv>

        * gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
        (gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
        (gst_ebml_read_element_length), (gst_ebml_read_buffer),
        (gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
        (gst_ebml_read_float), (gst_ebml_read_ascii),
        (gst_ebml_read_binary):
          Don't create unnecessary sub-buffers all the time. Dramatically
          improves performance with multiple concurrently running
          matroskademux instances (#341818) (and generally avoids doing
          unnecessarily inefficient things).