From: Jun Zhao <barryjz...@tencent.com> Use %.12g replace %.f when save AMF NUMBER(double) type to metadata. And update fate ref.
before this fix, we get FLV metadata like: Metadata: lasttimestamp : 113 lastkeyframetimestamp: 112 after this fix: Metadata: lasttimestamp : 113.005 lastkeyframetimestamp: 111.678 Signed-off-by: Jun Zhao <barryjz...@tencent.com> --- libavformat/flvdec.c | 2 +- tests/ref/fate/flv-add_keyframe_index | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 445d58d..12bfd4b 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -649,7 +649,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, sizeof(str_val)); av_dict_set(&s->metadata, key, str_val, 0); } else if (amf_type == AMF_DATA_TYPE_NUMBER) { - snprintf(str_val, sizeof(str_val), "%.f", num_val); + snprintf(str_val, sizeof(str_val), "%.12g", num_val); av_dict_set(&s->metadata, key, str_val, 0); } else if (amf_type == AMF_DATA_TYPE_STRING) { av_dict_set(&s->metadata, key, str_val, 0); diff --git a/tests/ref/fate/flv-add_keyframe_index b/tests/ref/fate/flv-add_keyframe_index index 1c4da65..ce3809e 100644 --- a/tests/ref/fate/flv-add_keyframe_index +++ b/tests/ref/fate/flv-add_keyframe_index @@ -7,6 +7,6 @@ canSeekToEnd=true datasize=629776 videosize=629381 audiosize=0 -lasttimestamp=20 +lasttimestamp=19.8571428571 lastkeyframetimestamp=19 lastkeyframelocation=597963 -- 1.7.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".