[MPlayer-dev-eng] [WORKAROUND] SEGV in dvdnav + audio

Robert Varga nite at hq.alert.sk
Sat Dec 28 04:03:51 CET 2002


Hi all

I apologize for sending a bugreport to this list, yet this is only
because I'm interested in learning the inner workings of mplayer,
so I can help with the dvdnav support (which I'd love to see working).

The bugreport itself:
When playing a DVD with dvdnav, ignoring its infancy, I got a classic
NULL pointer dereference at mplayer.c:2261 (actually deeper in
resync_audio_stream(), but this is the cause):

2656:   if (d_audio && audio_id!=aid_temp) {
                mp_msg(MSGT_INPUT,MSGL_DBG2,"d_audio->id change: was %d is now %d\n",
                        d_audio->id,aid_temp);
                // FIXME: need a bettery way to change audio stream id
                d_audio->id=dvdsub_id=aid_temp;
2661:           resync_audio_stream(sh_audio);
        }

This is because the DVD (Ghost In The Shell, to be precise), starts off with
the classic FBI warning, which does not have any sound:

Selected video codec: [mpeg12] vfm:libmpeg2 (MPEG 1 or 2 (libmpeg2))
==========================================================================
Audio: no sound!!!
Freeing 0 unused audio chunks
Start playing...

That's okay as long as the dvdnav doesn't send the first
DVDNAV_AUDIO_STREAM_CHANGE block, which is exactly at the start of the movie
itself. The current (dvdnav?) code relies on the fact audio has already
been initialized (i.e. sh_audio != NULL).

The quick fix is easy: put an "if (sh_audio)" in in front of
resync_audio_stream(), and the SIGSEGV is away.

The proper fix is to initialize audio once it is available, yet I don't
know how to do it (yet).

Could you please give me some hints? (And apply the attached trivial patch
in the meantime?).

Thanks,
Robert Varga
------------------------------------------------------------------------------
n at hq.sk                                          http://hq.sk/~nite/gpgkey.txt
-------------- next part --------------
--- mplayer.c.orig	2002-12-29 03:53:40.000000000 +0100
+++ mplayer.c	2002-12-29 03:54:01.000000000 +0100
@@ -2658,7 +2658,7 @@
                         d_audio->id,aid_temp);
                 // FIXME: need a bettery way to change audio stream id
                 d_audio->id=dvdsub_id=aid_temp;
-                resync_audio_stream(sh_audio);
+                if (sh_audio) resync_audio_stream(sh_audio);
         }
 
         break;


More information about the MPlayer-dev-eng mailing list