summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
Diffstat (limited to 'libhb')
-rw-r--r--libhb/sync.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/libhb/sync.c b/libhb/sync.c
index 575e079ae..5f7cbd4e6 100644
--- a/libhb/sync.c
+++ b/libhb/sync.c
@@ -383,23 +383,31 @@ static hb_buffer_t * mergeSubtitles(subtitle_sanitizer_t *sanitizer, int end)
sanitizer->list_current = a;
}
- sanitizer->list_current = a->next;
- if (sanitizer->list_current == NULL)
- sanitizer->last = NULL;
a->next = NULL;
b->s.start = a->s.stop;
buf = merge_ssa(a, b);
hb_buffer_close(&a);
+ a = buf;
+ buf = NULL;
+ sanitizer->list_current = a;
- if (b->s.stop != AV_NOPTS_VALUE && ABS(b->s.stop - b->s.start) <= 18000)
+ if (b->s.stop != AV_NOPTS_VALUE &&
+ ABS(b->s.stop - b->s.start) <= 18000)
{
// b and a completely overlap, remove b
- sanitizer->list_current = b->next;
- if (sanitizer->list_current == NULL)
- sanitizer->last = NULL;
+ a->next = b->next;
+ b->next = NULL;
+ if (sanitizer->last == b)
+ {
+ sanitizer->last = a;
+ }
hb_buffer_close(&b);
}
+ else
+ {
+ a->next = b;
+ }
}
else
{