r26350 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r26349‎ | r26350 | r26351 >
Date:03:15, 3 October 2007
Author:tstarling
Status:old
Tags:
Comment:
Applying cortado-truncation-bugfix.diff, as per r26204:

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/src/com/fluendo/plugin/AudioSink.java (modified) (history)

Diff [purge]

Index: trunk/extensions/OggHandler/cortado/src/com/fluendo/plugin/AudioSink.java
@@ -200,6 +200,9 @@
201201
202202 return res;
203203 }
 204+ public synchronized boolean isAcquired() {
 205+ return opened;
 206+ }
204207 public boolean release() {
205208 stop();
206209
@@ -430,6 +433,8 @@
431434 case Event.NEWSEGMENT:
432435 break;
433436 case Event.EOS:
 437+ // wait for completion, perform blocking drain of buffers
 438+ drain();
434439 break;
435440 }
436441 return true;
@@ -498,6 +503,32 @@
499504 return result;
500505 }
501506
 507+ /*
 508+ * Block until audio playback is finished
 509+ */
 510+ protected void drain() {
 511+ if (ringBuffer.rate <= 0) {
 512+ return;
 513+ }
 514+
 515+ /* need to start playback before we can drain, but only when
 516+ * we have successfully negotiated a format and thus acquired the
 517+ * ringbuffer. */
 518+ if (!ringBuffer.isAcquired()) {
 519+ // FIXME make it work like it does in GstBaseAudioSink
 520+ // ringBuffer.acquire(...);
 521+ return;
 522+ }
 523+
 524+ if (ringBuffer.nextSample != -1) {
 525+ long time = ringBuffer.nextSample * Clock.SECOND / ringBuffer.rate;
 526+ Clock.ClockID id = audioClock.newSingleShotID(time);
 527+ Debug.log(Debug.DEBUG, this+" waiting until t=" + ((double)time / Clock.SECOND) + "s for playback to finish");
 528+ id.waitID();
 529+ ringBuffer.nextSample = -1;
 530+ }
 531+ }
 532+
502533 protected abstract RingBuffer createRingBuffer();
503534 protected abstract boolean open (RingBuffer ring);
504535 protected abstract boolean close (RingBuffer ring);

Follow-up revisions

RevisionCommit summaryAuthorDate
r31776Play the ring buffer on drain() -- fixes the remaining issue in bug 11232.tstarling12:07, 11 March 2008

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r26204Fix for bug 11232. Improved port of GStreamer's GstBaseAudioSink (gstbaseaudi...tstarling11:36, 28 September 2007

Status & tagging log