summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorvan <[email protected]>2008-09-15 06:44:56 +0000
committervan <[email protected]>2008-09-15 06:44:56 +0000
commita5b76eee9e6637f26e4a60201e3d4bb77ab8ad72 (patch)
tree8f005b237b5a6b46e8079fc7c2aad12408a5b2b1 /libhb
parent46b030f0d27838a600d07850e9390a9f579f4317 (diff)
The difference of two timestamps referenced to different clocks is a random number & not useful input to the average frame size computation. This major brain-o would occasionally cause huge average frame times which, when later used to compute the SCR correction, would result in large gaps in the audio and/or video streams. Fixed by always computing the average frame size from the scr-corrected timestamps.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1698 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r--libhb/reader.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libhb/reader.c b/libhb/reader.c
index 8e9da7f7e..d1c0a598a 100644
--- a/libhb/reader.c
+++ b/libhb/reader.c
@@ -133,11 +133,12 @@ static void update_ipt( hb_reader_t *r, const hb_buffer_t *buf )
// such that 'buf' will follow the previous packet of this stream separated
// by the average packet time of the stream.
-static void new_scr_offset( hb_reader_t *r, const hb_buffer_t *buf )
+static void new_scr_offset( hb_reader_t *r, hb_buffer_t *buf )
{
stream_timing_t *st = id_to_st( r, buf );
- int64_t nxt = st->last + st->average - r->scr_offset;
+ int64_t nxt = st->last + st->average;
r->scr_offset = buf->renderOffset - nxt;
+ buf->renderOffset = nxt;
r->scr_changes = r->demux.scr_changes;
st->last = buf->renderOffset;
}
@@ -291,7 +292,10 @@ static void ReaderFunc( void * _r )
if ( r->scr_changes == r->demux.scr_changes )
{
// This packet is referenced to the same SCR as the last.
- // Update the average inter-packet time for this stream.
+ // Adjust timestamp to remove the System Clock Reference
+ // offset then update the average inter-packet time
+ // for this stream.
+ buf->renderOffset -= r->scr_offset;
update_ipt( r, buf );
}
else
@@ -302,8 +306,6 @@ static void ReaderFunc( void * _r )
// average spacing.
new_scr_offset( r, buf );
}
- // adjust timestamps to remove System Clock Reference offsets.
- buf->renderOffset -= r->scr_offset;
}
if ( buf->start != -1 )
buf->start -= r->scr_offset;