player: do not drop trailing packets

This commit is contained in:
Peter Wu 2012-07-12 17:42:44 +02:00
parent ee46a189a6
commit 82b7345944

View file

@ -58,7 +58,6 @@ namespace Player{
char buff[1024 * 10]; char buff[1024 * 10];
if (fileSrc.good()){ if (fileSrc.good()){
fileSrc.read(buff, sizeof(buff)); fileSrc.read(buff, sizeof(buff));
if (fileSrc.eof()) return -1;
buffer.append(buff, fileSrc.gcount()); buffer.append(buff, fileSrc.gcount());
return fileSrc.gcount(); return fileSrc.gcount();
} }
@ -177,7 +176,7 @@ seekDone:
void File::Play() { void File::Play() {
long long now, timeDiff = 0, lastTime = 0; long long now, timeDiff = 0, lastTime = 0;
while (fileSrc.good()) { while (fileSrc.good() || !inBuffer.empty()) {
if (readCommand()) { if (readCommand()) {
continue; continue;
} }