From 509a9e2f75ab598d0304ed65fffd2002b147bf30 Mon Sep 17 00:00:00 2001 From: Sergey Dryabzhinsky Date: Sun, 20 Sep 2015 00:22:50 +0300 Subject: [PATCH] Fix data type for frame rate and duration --- ngx_rtmp_codec_module.c | 7 +++---- ngx_rtmp_codec_module.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ngx_rtmp_codec_module.c b/ngx_rtmp_codec_module.c index e29cd28..5a98618 100644 --- a/ngx_rtmp_codec_module.c +++ b/ngx_rtmp_codec_module.c @@ -888,20 +888,19 @@ ngx_rtmp_codec_meta_data(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h, if (v.width != -1) ctx->width = (ngx_uint_t) v.width; if (v.height != -1) ctx->height = (ngx_uint_t) v.height; - if (v.duration != -1) ctx->duration = (ngx_uint_t) v.duration; + if (v.duration != -1) ctx->duration = (double) v.duration; if (v.frame_rate != -1) ctx->frame_rate = (double) v.frame_rate; if (v.video_data_rate != -1) ctx->video_data_rate = (ngx_uint_t) v.video_data_rate; if (v.video_codec_id_n != -1) ctx->video_codec_id = (ngx_uint_t) v.video_codec_id_n; if (v.audio_data_rate != -1) ctx->audio_data_rate = (ngx_uint_t) v.audio_data_rate; if (v.audio_codec_id_n != -1) ctx->audio_codec_id = (v.audio_codec_id_n == 0 - ? 0 : v.audio_codec_id_n == 0 - ? NGX_RTMP_AUDIO_UNCOMPRESSED : (ngx_uint_t) v.audio_codec_id_n); + ? NGX_RTMP_AUDIO_UNCOMPRESSED : (ngx_uint_t) v.audio_codec_id_n); if (v.profile[0] != '\0') ngx_memcpy(ctx->profile, v.profile, sizeof(v.profile)); if (v.level[0] != '\0') ngx_memcpy(ctx->level, v.level, sizeof(v.level)); ngx_log_debug8(NGX_LOG_DEBUG, s->connection->log, 0, "codec: data frame: " - "width=%ui height=%ui duration=%ui frame_rate=%.3f " + "width=%ui height=%ui duration=%.3f frame_rate=%.3f " "video=%s (%ui) audio=%s (%ui)", ctx->width, ctx->height, ctx->duration, ctx->frame_rate, ngx_rtmp_get_video_codec_name(ctx->video_codec_id), diff --git a/ngx_rtmp_codec_module.h b/ngx_rtmp_codec_module.h index 831f02b..877d212 100644 --- a/ngx_rtmp_codec_module.h +++ b/ngx_rtmp_codec_module.h @@ -52,7 +52,7 @@ u_char * ngx_rtmp_get_video_codec_name(ngx_uint_t id); typedef struct { ngx_uint_t width; ngx_uint_t height; - ngx_uint_t duration; + double duration; double frame_rate; ngx_uint_t video_data_rate; ngx_uint_t video_codec_id;