r26204 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r26203‎ | r26204 | r26205 >
Date:11:36, 28 September 2007
Author:tstarling
Status:old
Tags:
Comment:
Fix for bug 11232. Improved port of GStreamer's GstBaseAudioSink (gstbaseaudiosink.c in gst-plugins-base). AudioSink should block on EOS until playback is finished. This behaviour is also mentioned in GStreamer's part-element-sink.txt.
Modified paths:
  • /trunk/extensions/OggHandler/cortado-truncation-bugfix.diff (added) (history)

Diff [purge]

Index: trunk/extensions/OggHandler/cortado-truncation-bugfix.diff
@@ -0,0 +1,57 @@
 2+Index: src/com/fluendo/plugin/AudioSink.java
 3+===================================================================
 4+--- src/com/fluendo/plugin/AudioSink.java (revision 5517)
 5+@@ -200,6 +200,9 @@
 6+
 7+ return res;
 8+ }
 9++ public synchronized boolean isAcquired() {
 10++ return opened;
 11++ }
 12+ public boolean release() {
 13+ stop();
 14+
 15+@@ -430,6 +433,8 @@
 16+ case Event.NEWSEGMENT:
 17+ break;
 18+ case Event.EOS:
 19++ // wait for completion, perform blocking drain of buffers
 20++ drain();
 21+ break;
 22+ }
 23+ return true;
 24+@@ -498,6 +503,32 @@
 25+ return result;
 26+ }
 27+
 28++ /*
 29++ * Block until audio playback is finished
 30++ */
 31++ protected void drain() {
 32++ if (ringBuffer.rate <= 0) {
 33++ return;
 34++ }
 35++
 36++ /* need to start playback before we can drain, but only when
 37++ * we have successfully negotiated a format and thus acquired the
 38++ * ringbuffer. */
 39++ if (!ringBuffer.isAcquired()) {
 40++ // FIXME make it work like it does in GstBaseAudioSink
 41++ // ringBuffer.acquire(...);
 42++ return;
 43++ }
 44++
 45++ if (ringBuffer.nextSample != -1) {
 46++ long time = ringBuffer.nextSample * Clock.SECOND / ringBuffer.rate;
 47++ Clock.ClockID id = audioClock.newSingleShotID(time);
 48++ Debug.log(Debug.DEBUG, this+" waiting until t=" + ((double)time / Clock.SECOND) + "s for playback to finish");
 49++ id.waitID();
 50++ ringBuffer.nextSample = -1;
 51++ }
 52++ }
 53++
 54+ protected abstract RingBuffer createRingBuffer();
 55+ protected abstract boolean open (RingBuffer ring);
 56+ protected abstract boolean close (RingBuffer ring);
 57+

Follow-up revisions

RevisionCommit summaryAuthorDate
r26350Applying cortado-truncation-bugfix.diff, as per r26204:...tstarling03:15, 3 October 2007
r31776Play the ring buffer on drain() -- fixes the remaining issue in bug 11232.tstarling12:07, 11 March 2008

Status & tagging log