asfdemux: fix performance issue, especially with high-bitrate streams
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Thu, 12 Apr 2012 12:56:48 +0000 (13:56 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Mon, 16 Apr 2012 07:02:46 +0000 (09:02 +0200)
commit3064bf4a86ad7ee927af3ebac2aeffebac1d1ce2
treeca06f14f488d5c89b83af338dfff47b108a303c2
parent65436c8715556d4cdf2b049eae2ddcb5c801c7b5
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.

Conflicts:

gst/asfdemux/asfpacket.c
gst/asfdemux/asfpacket.h
gst/asfdemux/asfpacket.c
gst/asfdemux/asfpacket.h