This will allow a workaround for cases where input timestamps are invalid or
when decoder delay of 1 packet or more confuses avconv into using the wrong
timestamps as a sync reference.
---
 avconv.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/avconv.c b/avconv.c
index 95dc8d8..39ba005 100644
--- a/avconv.c
+++ b/avconv.c
@@ -1102,7 +1102,7 @@ static void do_audio_out(AVFormatContext *s, OutputStream 
*ost,
         ost->reformat_pair = MAKE_SFMT_PAIR(enc->sample_fmt,dec->sample_fmt);
     }
 
-    if (audio_sync_method) {
+    if (audio_sync_method > 0) {
         double delta = get_sync_ipts(ost, ist->last_dts) * enc->sample_rate - 
ost->sync_opts -
                        av_fifo_size(ost->fifo) / (enc->channels * osize);
         int idelta = delta * dec->sample_rate / enc->sample_rate;
@@ -1149,7 +1149,7 @@ static void do_audio_out(AVFormatContext *s, OutputStream 
*ost,
                 av_resample_compensate(*(struct 
AVResampleContext**)ost->resample, comp, enc->sample_rate);
             }
         }
-    } else
+    } else if (audio_sync_method == 0)
         ost->sync_opts = lrintf(get_sync_ipts(ost, ist->last_dts) * 
enc->sample_rate) -
                                 av_fifo_size(ost->fifo) / (enc->channels * 
osize); // FIXME wrong
 
-- 
1.7.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to