summaryrefslogtreecommitdiffstats
path: root/mp3lib
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-02-05 19:24:03 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-02-05 19:24:03 +0000
commit2225b00ca61c4fb7ed2e1cbd1bcfd65e63be9cb8 (patch)
tree1c0bd490b02657430122e63c2ad8f60faf8bc9fa /mp3lib
parentbbc6f9a1c3fd65b4f2dc31c97c2c5f85bebc6324 (diff)
downloadmpv-2225b00ca61c4fb7ed2e1cbd1bcfd65e63be9cb8.tar.bz2
mpv-2225b00ca61c4fb7ed2e1cbd1bcfd65e63be9cb8.tar.xz
Make sure buffer is aligned so no unaligned access happens.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22158 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mp3lib')
-rw-r--r--mp3lib/sr1.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/mp3lib/sr1.c b/mp3lib/sr1.c
index 5fdab721a7..1782e599ba 100644
--- a/mp3lib/sr1.c
+++ b/mp3lib/sr1.c
@@ -315,7 +315,10 @@ LOCAL int stream_read_frame_body(int size){
*/
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 @@ resync:
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 @@ resync:
#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 @@ retry1:
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