Fixed generation of sliced data frames, setting the end stream flag

only when all the content has been generated.
This commit is contained in:
Simone Bordet 2014-06-13 22:59:48 +02:00
parent a58a5f8268
commit d4783369bc
1 changed files with 4 additions and 3 deletions

View File

@ -67,10 +67,11 @@ public class DataGenerator
int end = data.limit();
for (int i = 1; i <= frames; ++i)
{
data.limit(begin + Math.min(dataBytesPerFrame * i, length));
int limit = begin + Math.min(dataBytesPerFrame * i, length);
data.limit(limit);
ByteBuffer slice = data.slice();
data.position(data.limit());
generateFrame(lease, streamId, slice, i == frames && last);
data.position(limit);
generateFrame(lease, streamId, slice, i == frames && last && limit == end);
}
data.limit(end);
}