[MPlayer-dev-eng] Re: Bug#409431: mplayer: [ia64] unaligned access messages during playback

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Feb 3 10:58:18 CET 2007


Hello,
On Fri, Feb 02, 2007 at 05:22:21PM -0700, Bryan Stillwell wrote:
> Package: mplayer
> Version: 1.0~rc1-12
> Severity: normal
> 
> When using the right arrow to skip forward in the below video on an
> Itanium2 based system, I'm getting multiple "unaligned access" messages
> which results in a hefty performance hit.
> 
> http://media.armadilloaerospace.com/2005_10_10/XPCFlight.mpg

[...]
> ------ begin ------
> (gdb) r -vo xv -ao null ~/XPCFlight.mpg
> Starting program: /home/bryan/src/mplayer/mplayer-1.0~rc1/mplayer -vo xv 
> -ao null ~/XPCFlight.mpg
> [Thread debugging using libthread_db enabled]
> [New Thread 2305843009233482112 (LWP 7458)]
> MPlayer 1.0rc1-4.1.2 (C) 2000-2006 MPlayer Team
> CPU: Intel Itanium
> 
> Playing /home/bryan/XPCFlight.mpg.
> MPEG-PS file format detected.
> VIDEO:  MPEG1  352x272  (aspect 12)  29.970 fps  1000.0 kbps (125.0 kbyte/s)
> ==========================================================================
> Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
> VDec: vo config request - 352 x 272 (preferred colorspace: Mpeg PES)
> Could not find matching colorspace - retrying with -vf scale...
> Opening video filter: [scale]
> The selected video_out device is incompatible with this codec.
> Try adding the scale filter, e.g. -vf spp,scale instead of -vf spp.
> VDecoder init failed :(
> Opening video decoder: [libmpeg2] MPEG 1/2 Video decoder libmpeg2-v0.4.0b
> Selected video codec: [mpeg12] vfm: libmpeg2 (MPEG-1 or 2 (libmpeg2))
> ==========================================================================
> ==========================================================================
> Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
> AUDIO: 48000 Hz, 2 ch, s16le, 96.0 kbit/6.25% (ratio: 12000->192000)
> Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
> ==========================================================================
> AO: [null] 48000Hz 2ch s16le (2 bytes per sample)
> Starting playback...
> VDec: vo config request - 352 x 272 (preferred colorspace: Planar YV12)
> VDec: using Planar YV12 as output csp (no 0)
> Movie-Aspect is 1.15:1 - prescaling to correct movie aspect.
> VO: [xv] 352x272 => 352x306 Planar YV12
> New_Face failed. Maybe the font path is wrong. 2 ??% ??% ??,?% 1 0
> Please supply the text font file (~/.mplayer/subfont.ttf).
> subtitle font: load_sub_face failed.
> mplayer(7458): unaligned access to 0x60000ffffe319604, ip=0x4000000000879d80
> mplayer(7458): unaligned access to 0x60000ffffe319604, ip=0x4000000000879da0
> mplayer(7458): unaligned access to 0x60000ffffe319604, ip=0x4000000000879d80
> mplayer(7458): unaligned access to 0x60000ffffe319604, ip=0x4000000000879da0
> mplayer(7458): unaligned access to 0x60000ffffe319604, ip=0x4000000000879d80
> A:   0.0 V:   0.0 A-V:  0.000 ct: -0.000  73/ 73 ??% ??% ??,?% 0 0
> 
> Exiting... (End of file)
> 
> Program exited normally.
> (gdb) list *0x4000000000879d80
> 0x4000000000879d80 is in MP3_DecodeFrame (sr1.c:199).
> 194     #endif
> 195       return TRUE;
> 196     }
> 197
> 198     LOCAL int stream_head_shift(unsigned char *hbuf,unsigned long 
> *head){
> 199       *((unsigned long *)hbuf) >>= 8;
> 200       if(mp3_read(hbuf+3,1) != 1) return 0;
> 201       *head <<= 8;
> 202       *head |= hbuf[3];
> 203       return 1;
> (gdb) list *0x4000000000879da0
> 0x4000000000879da0 is in MP3_DecodeFrame (sr1.c:199).
> 194     #endif
> 195       return TRUE;
> 196     }
> 197
> 198     LOCAL int stream_head_shift(unsigned char *hbuf,unsigned long 
> *head){
> 199       *((unsigned long *)hbuf) >>= 8;
> 200       if(mp3_read(hbuf+3,1) != 1) return 0;
> 201       *head <<= 8;
> 202       *head |= hbuf[3];
> 203       return 1;
> ------ end ------
[...]

Please try attached patch if it fixes it.
http://www.mpg123.de/ is mentioned as upstream for this code, but the
SVN there does not contain a sr1.c, so should this just be applied
directly to MPlayer?

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: mp3lib/sr1.c
===================================================================
--- mp3lib/sr1.c	(revision 22099)
+++ mp3lib/sr1.c	(working copy)
@@ -315,7 +315,10 @@
  */
 LOCAL int read_frame(struct frame *fr){
   unsigned long newhead;
-  unsigned char hbuf[8];
+  union {
+    unsigned char buf[8];
+    unsigned long dummy; // for alignment
+  } hbuf;
   int skipped,resyncpos;
   int frames=0;
 
@@ -325,7 +328,7 @@
 
   set_pointer(512);
   fsizeold=fr->framesize;       /* for Layer3 */
-  if(!stream_head_read(hbuf,&newhead)) return 0;
+  if(!stream_head_read(hbuf.buf,&newhead)) return 0;
   if(!decode_header(fr,newhead)){
     // invalid header! try to resync stream!
 #ifdef DEBUG_RESYNC
@@ -333,7 +336,7 @@
 #endif
 retry1:
     while(!decode_header(fr,newhead)){
-      if(!stream_head_shift(hbuf,&newhead)) return 0;
+      if(!stream_head_shift(hbuf.buf,&newhead)) return 0;
     }
     resyncpos=MP3_fpos-4;
     // found valid header
@@ -343,14 +346,14 @@
     if(!stream_read_frame_body(fr->framesize)) return 0; // read body
     set_pointer(512);
     fsizeold=fr->framesize;       /* for Layer3 */
-    if(!stream_head_read(hbuf,&newhead)) return 0;
+    if(!stream_head_read(hbuf.buf,&newhead)) return 0;
     if(!decode_header(fr,newhead)){
       // invalid hdr! go back...
 #ifdef DEBUG_RESYNC
       printf("INVALID\n");
 #endif
 //      mp3_seek(resyncpos+1);
-      if(!stream_head_read(hbuf,&newhead)) return 0;
+      if(!stream_head_read(hbuf.buf,&newhead)) return 0;
       goto retry1;
     }
 #ifdef DEBUG_RESYNC


More information about the MPlayer-dev-eng mailing list