Pre-Record GStreamer Element
The GStreamer pre-record element can be placed in the pipeline to allow you to be continually recording data into a FIFO, where you can sent the FIFO size based on the amount of pre-recorded data you want kept. The FIFO size is specified in milliseconds. When pre-recording the GStreamer pre-record element doesn't pass any buffer downstream. After the FIFO is filled the oldest data is release as new data is added. When you want to start recording, you can trigger the GStreamer pre-record element. Once triggered, the element will pass the data in the FIFO downstream (to be saved to a file for example) while adding any new data to the back of the FIFO buffer so no data is lost. Eventually the downstream elements will drain the FIFO such that the GStreamer pre-record element simply passes received buffers downstream as they are received. Once the GStreamer pipeline is taken out of the PLAY state, the GStreamer pre-record element resets and will again go into pre-record mode of operation.