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 | +
|