From 0cac9f92c44461dc687025f33ebf2f628a20779d Mon Sep 17 00:00:00 2001 From: Yusuke Nakamura Date: Thu, 7 Jul 2011 04:25:49 +0900 Subject: [PATCH] Fix caching the last accessed entry number when removing a entry. Discard the last accessed entry info when we can't know immediately the number of entry removed just now. --- isom.c | 2 +- utils.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/isom.c b/isom.c index 27bdf23..d932217 100644 --- a/isom.c +++ b/isom.c @@ -5105,7 +5105,7 @@ int lsmash_update_track_duration( lsmash_root_t *root, uint32_t track_ID, uint32 return -1; if( isom_update_mdhd_duration( trak, last_sample_delta ) ) return -1; - /* If the presentation won't be extended and this track has any edit, we don't change or update duration in tkhd and mvhd. */ + /* If the presentation won't be extended and this track has any edit, we don't change or update duration in tkhd. */ return (!root->fragment && trak->edts && trak->edts->elst) ? isom_update_mvhd_duration( root->moov ) /* Only update movie duration. */ : isom_update_tkhd_duration( trak ); /* Also update movie duration internally. */ diff --git a/utils.c b/utils.c index b76144c..98ece81 100644 --- a/utils.c +++ b/utils.c @@ -542,6 +542,13 @@ int lsmash_remove_entry_direct( lsmash_entry_list_t *list, lsmash_entry_t *entry list->last_accessed_number = 0; } } + else + { + /* We can't know the current entry number immediately, + * so discard the last accessed entry info because time is wasted to know it. */ + list->last_accessed_entry = NULL; + list->last_accessed_number = 0; + } free( entry ); list->entry_count -= 1; return 0; -- 2.11.4.GIT