diff mbox

[FFmpeg-devel,2/4] avcodec/mediacodecdec: use AV_TIME_BASE_Q

Message ID 20180424205926.42027-2-ffmpeg@tmm1.net
State Accepted
Commit 7a4639b1eba31f88490c85663c75fb1414307680
Headers show

Commit Message

Aman Gupta April 24, 2018, 8:59 p.m. UTC
From: Aman Gupta <aman@tmm1.net>

---
 libavcodec/mediacodecdec_common.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Matthieu Bouron April 25, 2018, 4:05 p.m. UTC | #1
On Tue, Apr 24, 2018 at 01:59:24PM -0700, Aman Gupta wrote:
> From: Aman Gupta <aman@tmm1.net>
> 
> ---
>  libavcodec/mediacodecdec_common.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c
> index 0c27624dea..56b3c4fd1e 100644
> --- a/libavcodec/mediacodecdec_common.c
> +++ b/libavcodec/mediacodecdec_common.c
> @@ -209,7 +209,7 @@ static int mediacodec_wrap_hw_buffer(AVCodecContext *avctx,
>  
>      if (avctx->pkt_timebase.num && avctx->pkt_timebase.den) {
>          frame->pts = av_rescale_q(info->presentationTimeUs,
> -                                      av_make_q(1, 1000000),
> +                                      AV_TIME_BASE_Q,
>                                        avctx->pkt_timebase);
>      } else {
>          frame->pts = info->presentationTimeUs;
> @@ -298,7 +298,7 @@ static int mediacodec_wrap_sw_buffer(AVCodecContext *avctx,
>       *   * 0-sized avpackets are pushed to flush remaining frames at EOS */
>      if (avctx->pkt_timebase.num && avctx->pkt_timebase.den) {
>          frame->pts = av_rescale_q(info->presentationTimeUs,
> -                                      av_make_q(1, 1000000),
> +                                      AV_TIME_BASE_Q,
>                                        avctx->pkt_timebase);
>      } else {
>          frame->pts = info->presentationTimeUs;
> @@ -610,7 +610,7 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, MediaCodecDecContext *s,
>              uint32_t flags = ff_AMediaCodec_getBufferFlagEndOfStream(codec);
>  
>              if (s->surface) {
> -                pts = av_rescale_q(pts, avctx->pkt_timebase, av_make_q(1, 1000000));
> +                pts = av_rescale_q(pts, avctx->pkt_timebase, AV_TIME_BASE_Q);
>              }
>  
>              av_log(avctx, AV_LOG_DEBUG, "Sending End Of Stream signal\n");
> @@ -634,7 +634,7 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, MediaCodecDecContext *s,
>              offset += size;
>  
>              if (avctx->pkt_timebase.num && avctx->pkt_timebase.den) {
> -                pts = av_rescale_q(pts, avctx->pkt_timebase, av_make_q(1, 1000000));
> +                pts = av_rescale_q(pts, avctx->pkt_timebase, AV_TIME_BASE_Q);
>              }
>  
>              status = ff_AMediaCodec_queueInputBuffer(codec, index, 0, size, pts, 0);
> -- 
> 2.14.2
> 

LGTM.
diff mbox

Patch

diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c
index 0c27624dea..56b3c4fd1e 100644
--- a/libavcodec/mediacodecdec_common.c
+++ b/libavcodec/mediacodecdec_common.c
@@ -209,7 +209,7 @@  static int mediacodec_wrap_hw_buffer(AVCodecContext *avctx,
 
     if (avctx->pkt_timebase.num && avctx->pkt_timebase.den) {
         frame->pts = av_rescale_q(info->presentationTimeUs,
-                                      av_make_q(1, 1000000),
+                                      AV_TIME_BASE_Q,
                                       avctx->pkt_timebase);
     } else {
         frame->pts = info->presentationTimeUs;
@@ -298,7 +298,7 @@  static int mediacodec_wrap_sw_buffer(AVCodecContext *avctx,
      *   * 0-sized avpackets are pushed to flush remaining frames at EOS */
     if (avctx->pkt_timebase.num && avctx->pkt_timebase.den) {
         frame->pts = av_rescale_q(info->presentationTimeUs,
-                                      av_make_q(1, 1000000),
+                                      AV_TIME_BASE_Q,
                                       avctx->pkt_timebase);
     } else {
         frame->pts = info->presentationTimeUs;
@@ -610,7 +610,7 @@  int ff_mediacodec_dec_send(AVCodecContext *avctx, MediaCodecDecContext *s,
             uint32_t flags = ff_AMediaCodec_getBufferFlagEndOfStream(codec);
 
             if (s->surface) {
-                pts = av_rescale_q(pts, avctx->pkt_timebase, av_make_q(1, 1000000));
+                pts = av_rescale_q(pts, avctx->pkt_timebase, AV_TIME_BASE_Q);
             }
 
             av_log(avctx, AV_LOG_DEBUG, "Sending End Of Stream signal\n");
@@ -634,7 +634,7 @@  int ff_mediacodec_dec_send(AVCodecContext *avctx, MediaCodecDecContext *s,
             offset += size;
 
             if (avctx->pkt_timebase.num && avctx->pkt_timebase.den) {
-                pts = av_rescale_q(pts, avctx->pkt_timebase, av_make_q(1, 1000000));
+                pts = av_rescale_q(pts, avctx->pkt_timebase, AV_TIME_BASE_Q);
             }
 
             status = ff_AMediaCodec_queueInputBuffer(codec, index, 0, size, pts, 0);