summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--contrib/libdvdnav/A06-reset-mutex.patch25
-rw-r--r--libhb/dvdnav.c18
2 files changed, 43 insertions, 0 deletions
diff --git a/contrib/libdvdnav/A06-reset-mutex.patch b/contrib/libdvdnav/A06-reset-mutex.patch
new file mode 100644
index 000000000..76f55e348
--- /dev/null
+++ b/contrib/libdvdnav/A06-reset-mutex.patch
@@ -0,0 +1,25 @@
+Index: src/dvdnav.c
+===================================================================
+--- libdvdnav.orig/src/dvdnav.c (revision 1168)
++++ libdvdnav/src/dvdnav.c (working copy)
+@@ -178,9 +178,9 @@
+ #ifdef LOG_DEBUG
+ fprintf(MSG_OUT, "libdvdnav: clearing dvdnav\n");
+ #endif
++ pthread_mutex_unlock(&this->vm_lock);
+ result = dvdnav_clear(this);
+
+- pthread_mutex_unlock(&this->vm_lock);
+ return result;
+ }
+
+@@ -519,7 +519,8 @@
+ }
+
+ /* Check to see if we need to change the currently opened VOB */
+- if((this->position_current.vts != this->position_next.vts) ||
++ if((this->file == NULL) ||
++ (this->position_current.vts != this->position_next.vts) ||
+ (this->position_current.domain != this->position_next.domain)) {
+ dvd_read_domain_t domain;
+ int32_t vtsN;
diff --git a/libhb/dvdnav.c b/libhb/dvdnav.c
index 8d7ac70e7..09d0ad2e4 100644
--- a/libhb/dvdnav.c
+++ b/libhb/dvdnav.c
@@ -836,6 +836,7 @@ static int hb_dvdnav_start( hb_dvd_t * e, hb_title_t *title, int c )
{
return 0;
}
+ dvdnav_reset( d->dvdnav );
chapter = hb_list_item( title->list_chapter, c - 1);
if (chapter != NULL)
result = dvdnav_program_play(d->dvdnav, t, chapter->pgcn, chapter->pgn);
@@ -905,6 +906,13 @@ static int hb_dvdnav_seek( hb_dvd_t * e, float f )
int32_t title, pgcn, pgn;
if (dvdnav_current_title_program( d->dvdnav, &title, &pgcn, &pgn ) != DVDNAV_STATUS_OK)
hb_log("dvdnav cur pgcn err: %s", dvdnav_err_to_string(d->dvdnav));
+ // If we find ourselves in a new title, it means a title
+ // transition was made while reading data. Jumping between
+ // titles can cause the vm to get into a bad state. So
+ // reset the vm in this case.
+ if ( d->title != title )
+ dvdnav_reset( d->dvdnav );
+
if ( d->title != title || chapter->pgcn != pgcn )
{
// this chapter is in a different pgc - switch to it.
@@ -1088,6 +1096,16 @@ static int hb_dvdnav_read( hb_dvd_t * e, hb_buffer_t * b )
* event can be used to query such information only when
* necessary and update the decoding/displaying accordingly.
*/
+ {
+ int tt = 0, pgcn = 0, pgn = 0, c;
+
+ dvdnav_current_title_program(d->dvdnav, &tt, &pgcn, &pgn);
+ if (tt != d->title)
+ {
+ // Transition to another title signals that we are done.
+ return 0;
+ }
+ }
break;
case DVDNAV_CELL_CHANGE: