GNOME Bugzilla – Bug 790114
decklinkaudiosink: Re-implement around GstBaseSink instead of GstAudioBaseSink
Last modified: 2017-12-14 08:38:17 UTC
Putting this here for review and comments and questions for now. See commit message for (known) TODO items.
Created attachment 363286 [details] [review] decklinkaudiosink: Re-implement around GstBaseSink instead of GstAudioBaseSink The Decklink and GstAudioBaseSink APIs don't fit very well together, which causes various problems due to inaccuracies in the clock calculations and the actual ringbuffer and GStreamer's copy getting of sync. Problems are audio drop-outs and A/V sync getting wrong after pausing/seeking. TODO: - Trick mode support (resampling)
Created attachment 363287 [details] [review] decklinkaudiosink: Re-implement around GstBaseSink instead of GstAudioBaseSink The Decklink and GstAudioBaseSink APIs don't fit very well together, which causes various problems due to inaccuracies in the clock calculations and the actual ringbuffer and GStreamer's copy getting of sync. Problems are audio drop-outs and A/V sync getting wrong after pausing/seeking. TODO: - Trick mode support (resampling) - Replay after pause
Created attachment 364192 [details] [review] decklinkaudiosink: Re-implement around GstBaseSink instead of GstAudioBaseSink The Decklink and GstAudioBaseSink APIs don't fit very well together, which causes various problems due to inaccuracies in the clock calculations and the actual ringbuffer and GStreamer's copy getting of sync. Problems are audio drop-outs and A/V sync getting wrong after pausing/seeking.
Created attachment 364193 [details] [review] decklinkaudio/videosink: Wait until scheduled playback is actually stopped before continuing Otherwise we might "start" again, just to get finally stopped and then getting errors all over the place.
Created attachment 364194 [details] [review] decklinkaudiosink: Start audio pre-rolling if the output is not started yet in render() This seems to allow to schedule audio samples correctly at their right times already.
Created attachment 364195 [details] [review] decklinkaudiosink: Implement resampling/buffer reversing for trick-modes
Created attachment 364196 [details] [review] decklinkaudiosink: Implement resampling/buffer reversing for trick-modes
Created attachment 364197 [details] [review] decklinkaudiosink: Implement resampling/buffer reversing for trick-modes
Created attachment 364510 [details] [review] decklinkaudiosink: Don't return FLUSHING when we're stopping Otherwise we might return FLUSHING while pausing, which is less than ideal. Instead check basesink's flushing flag only.
Created attachment 364511 [details] [review] decklinkaudiosink: Check also against the clock if we run ahead of the clock too much The buffer level as reported by the Decklink driver is completely unreliable, and we could otherwise easily run ahead >1s if we're unlucky.
Created attachment 364608 [details] [review] decklinkvideosink: Wait until scheduled playback is actually stopped before continuing Otherwise we might "start" again, just to get finally stopped and then getting errors all over the place.
Created attachment 364609 [details] [review] decklinkaudiosink: Re-implement around GstBaseSink instead of GstAudioBaseSink The Decklink and GstAudioBaseSink APIs don't fit very well together, which causes various problems due to inaccuracies in the clock calculations and the actual ringbuffer and GStreamer's copy getting of sync. Problems are audio drop-outs and A/V sync getting wrong after pausing/seeking.
Created attachment 364610 [details] [review] decklinkaudiosink: Start audio pre-rolling if the output is not started yet in render() This seems to allow to schedule audio samples correctly at their right times already.
Created attachment 364611 [details] [review] decklinkaudiosink: Implement resampling/buffer reversing for trick-modes
Created attachment 364612 [details] [review] decklinkaudiosink: Check also against the clock if we run ahead of the clock too much The buffer level as reported by the Decklink driver is completely unreliable, and we could otherwise easily run ahead >1s if we're unlucky.
Created attachment 365131 [details] [review] decklinkaudiosink: Re-implement around GstBaseSink instead of GstAudioBaseSink The Decklink and GstAudioBaseSink APIs don't fit very well together, which causes various problems due to inaccuracies in the clock calculations and the actual ringbuffer and GStreamer's copy getting of sync. Problems are audio drop-outs and A/V sync getting wrong after pausing/seeking.
Created attachment 365132 [details] [review] decklinkaudiosink: Implement resampling/buffer reversing for trick-modes
Created attachment 365133 [details] [review] decklinkaudiosink: Check also against the clock if we run ahead of the clock too much The buffer level as reported by the Decklink driver is completely unreliable, and we could otherwise easily run ahead >1s if we're unlucky.
Created attachment 365134 [details] [review] decklinkaudiosink: Include final flow return in debug output
Created attachment 365135 [details] [review] decklinkaudiosink: Start audio pre-rolling if the output is not started yet in render() This seems to allow to schedule audio samples correctly at their right times already.
Created attachment 365137 [details] [review] decklinkvideosink: Only start if both sinks are set to PLAYING already Not only if the video sink is set to PLAYING so far. Also give more useful debug output about why we don't start, and don't start if already started. Also refactor the function to early-return instead of having a huge if-else block over the whole function.
Attachment 365131 [details] pushed as 86888d9 - decklinkaudiosink: Re-implement around GstBaseSink instead of GstAudioBaseSink Attachment 365132 [details] pushed as 118b296 - decklinkaudiosink: Implement resampling/buffer reversing for trick-modes Attachment 365133 [details] pushed as 3e70f00 - decklinkaudiosink: Check also against the clock if we run ahead of the clock too much Attachment 365134 [details] pushed as a38cf7d - decklinkaudiosink: Include final flow return in debug output Attachment 365135 [details] pushed as 2b8f82f - decklinkaudiosink: Start audio pre-rolling if the output is not started yet in render() Attachment 365137 [details] pushed as 0116497 - decklinkvideosink: Only start if both sinks are set to PLAYING already