summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2012-12-23 13:37:13 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2012-12-23 13:37:13 +0100
commitdee67e70610ad695276e115b25aebdedf94a641c (patch)
tree08907ad67858038c0db3fab8e43efca30327f9ac
parentd6efa529c906d034f2e7561a4cdc93b81ca80be0 (diff)
downloadvdr-dee67e70610ad695276e115b25aebdedf94a641c.tar.gz
vdr-dee67e70610ad695276e115b25aebdedf94a641c.tar.bz2
Fixed cIndexFile::GetNextIFrame() to properly handle the case where the very last frame is an I-frame
-rw-r--r--HISTORY2
-rw-r--r--recording.c19
2 files changed, 12 insertions, 9 deletions
diff --git a/HISTORY b/HISTORY
index 1f3e5228..dc3afca9 100644
--- a/HISTORY
+++ b/HISTORY
@@ -7456,3 +7456,5 @@ Video Disk Recorder Revision History
- Updated the Italian OSD texts (thanks to Diego Pierotto).
- Fixed replay stuttering close to the end of an ongoing recording (reported by Andreas
Regel).
+- Fixed cIndexFile::GetNextIFrame() to properly handle the case where the very last frame
+ is an I-frame (which normally shouldn't occur).
diff --git a/recording.c b/recording.c
index 02696cca..f40a9c95 100644
--- a/recording.c
+++ b/recording.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: recording.c 2.79 2012/12/23 13:30:37 kls Exp $
+ * $Id: recording.c 2.80 2012/12/23 13:34:06 kls Exp $
*/
#include "recording.h"
@@ -1939,15 +1939,16 @@ int cIndexFile::GetNextIFrame(int Index, bool Forward, uint16_t *FileNumber, off
*FileNumber = index[Index].number;
*FileOffset = index[Index].offset;
if (Length) {
- // all recordings end with a non-independent frame, so the following should be safe:
- uint16_t fn = index[Index + 1].number;
- off_t fo = index[Index + 1].offset;
- if (fn == *FileNumber)
- *Length = int(fo - *FileOffset);
- else {
- esyslog("ERROR: 'I' frame at end of file #%d", *FileNumber);
- *Length = -1;
+ if (Index < last) {
+ uint16_t fn = index[Index + 1].number;
+ off_t fo = index[Index + 1].offset;
+ if (fn == *FileNumber)
+ *Length = int(fo - *FileOffset);
+ else
+ *Length = -1; // this means "everything up to EOF" (the buffer's Read function will act accordingly)
}
+ else
+ *Length = -1;
}
return Index;
}