Merge branch 'master' into 0.11
diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c
index d160a52..42b13c6 100644
--- a/ext/flac/gstflacdec.c
+++ b/ext/flac/gstflacdec.c
@@ -1676,7 +1676,7 @@
         case GST_FORMAT_BYTES:
           scale = bytes_per_sample;
         case GST_FORMAT_DEFAULT:
-          *dest_value = gst_util_uint64_scale_int (src_value,
+          *dest_value = gst_util_uint64_scale_int_round (src_value,
               scale * flacdec->sample_rate, GST_SECOND);
           break;
         default:
diff --git a/gst/audioparsers/gstaacparse.c b/gst/audioparsers/gstaacparse.c
index 00999a0..070e949 100644
--- a/gst/audioparsers/gstaacparse.c
+++ b/gst/audioparsers/gstaacparse.c
@@ -331,8 +331,12 @@
   if ((data[0] == 0xff) && ((data[1] & 0xf6) == 0xf0)) {
     *framesize = gst_aac_parse_adts_get_frame_len (data);
 
-    /* In EOS mode this is enough. No need to examine the data further */
-    if (drain) {
+    /* In EOS mode this is enough. No need to examine the data further.
+       We also relax the check when we have sync, on the assumption that
+       if we're not looking at random data, we have a much higher chance
+       to get the correct sync, and this avoids losing two frames when
+       a single bit corruption happens. */
+    if (drain || !GST_BASE_PARSE_LOST_SYNC (aacparse)) {
       return TRUE;
     }