I just have found a bug in this patch, when resuming from the source
with multistream (those streams (except the first stream) will follow
the 0x20 ("new stream") command).
Since mms_get_current_pos() will return the pos relative to the current stream,
so we cannot rely on this function to get the current absolute
position in the multistream.
It will incorrectly resume the data from the multistream source.
The code to correctly resume multistream should look like this,
if (app.options().resume) {
off_t n;
if (mms) {
mms_seek(0,mms,file.size(),SEEK_SET);
// mms_seek() it will never seek beyond the current stream, so, this call
// of mms_get_current_pos() will always return the pos relative to the
// first stream.
off_t pos = mms_get_current_pos(mms);
while ((n = file.size()-pos) > 0) {
// mms_get_current_pos() will reset to 0 when it continue next stream
//while ((n = file.size()-mms_get_current_pos(mms)) > 0)
if (n > (off_t)buffer_size) n = buffer_size;
int n2;
if ((n2 = mms_read(0,mms,buffer,n)) <= 0) break;
pos += n2;
}
} else {
// not yet support
//mmsh_seek(0,mmsh,file.size(),SEEK_SET);
off_t pos = mmsh_get_current_pos(mmsh);
while ((n = file.size()-pos) > 0) {
//while ((n = file.size()-mmsh_get_current_pos(mmsh)) > 0)
if (n > (off_t)buffer_size) n = buffer_size;
int n2;
if ((n2 = mmsh_read(0,mmsh,buffer,n)) <= 0) break;
pos += n2;
}
}
}
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]