From b7dd425660c420466d951f09e3c67e9d5f9eec90 Mon Sep 17 00:00:00 2001
From: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
Date: Wed, 5 Oct 2022 10:19:27 -0300
Subject: [PATCH] misc: set frame time_base when decoding

To properly get the time_base and framerate in the plugins,
we need to set the frame properties when decoding.

GitLab: https://git.jami.net/savoirfairelinux/jami-plugins/-/issues/23

Change-Id: I69a2235c46b13a15414c4d01821cc1eba5b73987
---
 src/media/media_decoder.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/daemon/src/media/media_decoder.cpp b/daemon/src/media/media_decoder.cpp
index 7cba58abe63..cd1698a5048 100644
--- a/daemon/src/media/media_decoder.cpp
+++ b/daemon/src/media/media_decoder.cpp
@@ -644,6 +644,7 @@ MediaDecoder::decode(AVPacket& packet)
 #endif
     auto frame = f->pointer();
     ret = avcodec_receive_frame(decoderCtx_, frame);
+    frame->time_base = decoderCtx_->time_base;
     if (resolutionChangedCallback_) {
         if (decoderCtx_->width != width_ or decoderCtx_->height != height_) {
             JAMI_DBG("Resolution changed from %dx%d to %dx%d",
