playback broken

1 view
Skip to first unread message

Anjo Krank

unread,
Apr 12, 2008, 9:43:02 AM4/12/08
to milenia...@googlegroups.com
Hi,

as you know playback doesn't really work. The problem seems to be that
you assume a frame is either requested only once or returns null if it
already sent. the problem is aggrevated due to a minBuffer setting
that is too small.

request frame 0
buffer is empty-> fill buffer with 0-20
play frame 0->removes it from buffer
play frame 17->removes it from buffer

request frame 17 (again, as video plays slower than audio)
now buffersize is < minBuffer->load buffer from playhead
now frame 17 is in the buffer again and is also sent again...

Here's a transcript, as you can see, frame 12 is emitted twice (I
upped the minBuffer setting to 1000)

Buffered: 9 0
Buffered: 9 1
Buffered: 9 2
Buffered: 9 3
Buffered: 9 4
Buffered: 9 5
Buffered: 9 6
Buffered: 9 7
Buffered: 9 8
Buffered: 9 9
Buffered: 9 10
Buffered: 9 11
Buffered: 9 12
Buffered: 9 13
Buffered: 9 14
Played: 9 0
Played: 9 1
Played: 9 2
Played: 9 3
Played: 9 4
Played: 9 5
Played: 9 6
Played: 9 7
Played: 9 8
Played: 9 9
Played: 9 10
Played: 9 11
Played: 9 12
Played: 9 12
Buffered: 9 12
Buffered: 9 15
Buffered: 9 16
Buffered: 9 17
Buffered: 9 18
Buffered: 9 19
Buffered: 9 20
Buffered: 9 21
Buffered: 9 22
Buffered: 9 23
Buffered: 9 24
Buffered: 9 25
Buffered: 9 26
Played: 9 12
Played: 9 13
Played: 9 14
Played: 9 15

Here's a transcript with the default setting of 100:

Buffered: 9 0
Played: 9 0
Buffered: 9 0
Buffered: 9 1
Played: 9 0
Played: 9 1
Buffered: 9 1
Buffered: 9 2
Played: 9 1
Played: 9 2
Buffered: 9 2
Played: 9 2
Buffered: 9 2
Buffered: 9 3
Played: 9 2
Played: 9 3
Buffered: 9 3
Played: 9 3
Buffered: 9 3
Buffered: 9 4
Played: 9 3
Played: 9 4
Buffered: 9 4
Buffered: 9 5

Cheers, Anjo


Anjo Krank

unread,
Apr 12, 2008, 9:58:10 AM4/12/08
to milenia...@googlegroups.com
I suppose that streambuffers are not supposed to be shared. In that
case, you can

private int active = -1;

set it in getFrame()

actual = pool.remove( index );
active = index;

and check it in loadFrame():

if ( !pool.containsKey( indexX ) && indexX < bodysizes.size() &&
indexX >= 0 && active != indexX)

now it also works with a small setting of minBuffer.

Cheers, Anjo

Reply all
Reply to author
Forward
0 new messages