diff utils.c @ 406:ea22a438ca79 libavformat

fix obnoxious ogg_packet passing from encoder to muxer
author michael
date Sun, 04 Apr 2004 14:39:20 +0000
parents 6579fe3ade40
children b6949d80b7a9
line wrap: on
line diff
--- a/utils.c	Sun Apr 04 02:07:15 2004 +0000
+++ b/utils.c	Sun Apr 04 14:39:20 2004 +0000
@@ -1707,7 +1707,11 @@
     switch (st->codec.codec_type) {
     case CODEC_TYPE_AUDIO:
         frame_size = get_audio_frame_size(&st->codec, size);
-        if (frame_size >= 0) {
+
+        /* note, we skip the initial 0-size packets as they are most likely equal to the encoder delay,
+           but it would be better if we had the real timestamps from the encoder */
+//        av_log(s, AV_LOG_DEBUG, "%d %lld %lld\n", size, st->pts.num, st->pts.val);
+        if (frame_size >= 0 && (size || st->pts.num!=st->pts.den>>1 || st->pts.val)) {
             av_frac_add(&st->pts, 
                         (int64_t)s->pts_den * frame_size);
         }
@@ -1900,6 +1904,8 @@
     const char *q;
     int is_utc, len;
     char lastch;
+
+#undef time
     time_t now = time(0);
 
     len = strlen(datestr);