diff --git a/ChangeLog b/ChangeLog
index 0ff23b1dd..719512d82 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-02-06  Moritz Bunkus  <moritz@bunkus.org>
+
+	* mkvmerge: bug fix: Fixed the detection of AAC files whose first
+	AAC header does not start on the first byte of the file.
+
 2009-01-19  Moritz Bunkus  <moritz@bunkus.org>
 
 	* mmg: bug fix: It was possible to crash mmg by clicking onto the
diff --git a/src/common/aac_common.cpp b/src/common/aac_common.cpp
index 142c98127..727d9e4da 100644
--- a/src/common/aac_common.cpp
+++ b/src/common/aac_common.cpp
@@ -106,7 +106,6 @@ parse_aac_adif_header(unsigned char *buf,
 static bool
 is_adts_header(unsigned char *buf,
                int size,
-               int bpos,
                aac_header_t *aac_header,
                bool emphasis_present) {
   int id, profile, sfreq_index, channels, frame_length;
@@ -163,7 +162,7 @@ find_aac_header(unsigned char *buf,
   try {
     bpos = 0;
     while (bpos < size) {
-      if (is_adts_header(buf, size, bpos, aac_header, emphasis_present))
+      if (is_adts_header(buf + bpos, size - bpos, aac_header, emphasis_present))
         return bpos;
       bpos++;
     }
diff --git a/src/input/r_aac.cpp b/src/input/r_aac.cpp
index 1c08f5afd..beb42ceb5 100644
--- a/src/input/r_aac.cpp
+++ b/src/input/r_aac.cpp
@@ -98,7 +98,7 @@ aac_reader_c::aac_reader_c(track_info_c &_ti)
       adif = 1;
 
     } else {
-      if (find_aac_header(chunk, init_read_len, &aacheader, emphasis_present) != 0)
+      if (find_aac_header(chunk, init_read_len, &aacheader, emphasis_present) < 0)
         throw error_c(boost::format(Y("aac_reader: No valid AAC packet found in the first %1% bytes.\n")) % init_read_len);
       guess_adts_version();
       adif = 0;