author | Tim-Philipp Müller <tim.muller@collabora.co.uk> | |
Thu, 12 Apr 2012 12:56:48 +0000 (13:56 +0100) | ||
committer | Nikhil Devshatwar <a0132237@ti.com> | |
Fri, 17 May 2013 09:40:56 +0000 (15:10 +0530) | ||
commit | fb5552c941fe3cfb4499ffe87f2e5328ded182e5 | |
tree | cad0f2ffeca0e9f1e4a342c5af22b530e461f28a | tree | snapshot (tar.xz tar.gz zip) |
parent | 99ea3bcd854ee464d8ffc79667b9c49b81f01856 | commit | diff |
asfdemux: fix performance issue, especially with high-bitrate streams
Two things were suboptimal from a performance point of view:
a) consider a large media object such as a video keyframe, which
may be split up into multiple fragments. We would assemble
the media object as follows:
buf = join (join (join (frag1, frag2), frag3), frag4)
which causes many unnecessary memcpy()s, and malloc/free,
which could easily add up to a multiple of the actual object
size. To avoid this, we allocate a buffer of the size needed
from the start and copy fragments into that directly.
b) for every fragment to join, we would create a sub-buffer
before joining it (which would discard the sub-buffer again),
leading to unnecessary miniobject create/free churn.
Two things were suboptimal from a performance point of view:
a) consider a large media object such as a video keyframe, which
may be split up into multiple fragments. We would assemble
the media object as follows:
buf = join (join (join (frag1, frag2), frag3), frag4)
which causes many unnecessary memcpy()s, and malloc/free,
which could easily add up to a multiple of the actual object
size. To avoid this, we allocate a buffer of the size needed
from the start and copy fragments into that directly.
b) for every fragment to join, we would create a sub-buffer
before joining it (which would discard the sub-buffer again),
leading to unnecessary miniobject create/free churn.
gst/asfdemux/asfpacket.c | diff | blob | history | |
gst/asfdemux/asfpacket.h | diff | blob | history |