gremlin/gremlin.in: GStreamer pipelines are very expensive.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 19 Apr 2018 11:09:02 +0000 (12:09 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 20 Apr 2018 12:21:14 +0000 (13:21 +0100)
commit2a2c54c4ff7eb0cf13422aaf33ba36c53ca383a7
treea51ea7c0b7cb967d9f9438e0fd91fb2106e525f8
parentfbbde927eeb917bc5d5076259da5d9881b3816ca
gremlin/gremlin.in: GStreamer pipelines are very expensive.

AudioIdentifier would keep its pipeline lying around in case it needed
to do the heavyweight bitrate calculation.  But the directory grobbler
keeps an identifier for each master file in the directory, and in large
directories this means there are lots of live pipelines.  Since
pipelines maintain file descriptors and threads (and therefore
stack-segment address space), this can cause the gremlin to run out of
resources for no good reason.

Instead, factor out the pipeline setup, and shut the pipeline down
between initial identification and tag collection, and the possibly-
on-demand slow bitrate calculation.  There wasn't a lot of point in
retaining the pipeline for the bitrate calculation, because wading
through the file is much heavier than rebuilding the pipeline, so I
doubt whether anyone will care.
gremlin/gremlin.in