pinospay: keep buffers around until released

If we are using the original buffer fd without copying it into a temp
file we need to make sure the memory stays alive and is not reused until
all clients are done with it.

To do this, track what fd ids are in the outgoing buffers and ref the
original buffer. We also need to know when a message is sent to a client
and when that client does a release-fd on the fd index. This is done
with some new events on the multisocketsink.

Every time a message is sent to a client we hash the fd index in it and
ref the buffer in a per-client hash table (on the socket). Every time we
receive release-fd we remove the fd index from the hash and unref the
buffer again.

Clients that are killed get their socket removed, which also cleans up
the hashtable and frees the memory again.
This commit is contained in:
Wim Taymans 2015-12-02 21:03:53 +01:00
parent 7aa82d9476
commit 6864ea9830
2 changed files with 147 additions and 6 deletions

View file

@ -43,6 +43,7 @@ struct _GstPinosPay
GstAllocator *allocator;
guint32 id_counter;
};
struct _GstPinosPayClass