From 9012ba609bcb475e033b79bd3fec88609992bcb1 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sat, 16 Apr 2005 10:53:18 +0000 Subject: [PATCH] I/P frames were freed to early after a cluster has been rendered resulting in unresolvable brefs. --- ChangeLog | 7 +++++++ src/merge/pr_generic.cpp | 6 ++++-- src/merge/pr_generic.h | 9 +++++---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index c17e906e3..3e2c1af2c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-04-16 Moritz Bunkus + + * mkvmerge: bug fix: In rare occasions involving B frames mkvmerge + freed data too early. In such a case it was eating more and more + memory finally exiting with a message about not finding a packet + for a "bref". + 2005-04-09 Moritz Bunkus * all: bug fix: My output functions did not work on AMD64 diff --git a/src/merge/pr_generic.cpp b/src/merge/pr_generic.cpp index 230e9aaa7..cfc64650f 100644 --- a/src/merge/pr_generic.cpp +++ b/src/merge/pr_generic.cpp @@ -50,7 +50,8 @@ generic_packetizer_c::generic_packetizer_c(generic_reader_c *nreader, reader = nreader; track_entry = NULL; - free_refs = -1; + m_free_refs = -1; + m_next_free_refs = -1; enqueued_bytes = 0; safety_last_timecode = 0; safety_last_duration = 0; @@ -1073,7 +1074,8 @@ generic_packetizer_c::handle_avi_audio_sync(int64_t num_bytes, void generic_packetizer_c::connect(generic_packetizer_c *src, int64_t _append_timecode_offset) { - free_refs = src->free_refs; + m_free_refs = src->m_free_refs; + m_next_free_refs = src->m_next_free_refs; track_entry = src->track_entry; hserialno = src->hserialno; htrack_type = src->htrack_type; diff --git a/src/merge/pr_generic.h b/src/merge/pr_generic.h index 80054bf31..ce50727c5 100644 --- a/src/merge/pr_generic.h +++ b/src/merge/pr_generic.h @@ -447,7 +447,7 @@ protected: deque packet_queue, deferred_packets; int64_t initial_displacement; - int64_t free_refs, enqueued_bytes; + int64_t m_free_refs, m_next_free_refs, enqueued_bytes; int64_t safety_last_timecode, safety_last_duration; KaxTrackEntry *track_entry; @@ -522,11 +522,12 @@ public: return enqueued_bytes; } - virtual void set_free_refs(int64_t nfree_refs) { - free_refs = nfree_refs; + virtual void set_free_refs(int64_t free_refs) { + m_free_refs = m_next_free_refs; + m_next_free_refs = free_refs; } virtual int64_t get_free_refs() { - return free_refs; + return m_free_refs; } virtual void set_headers(); virtual void fix_headers();