-
-
Save tmm1/b209155c2414f4a30c6e20ddc6dea236 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c | |
index 3a4240aa95..a311cc3e54 100644 | |
--- a/libavcodec/mediacodecdec.c | |
+++ b/libavcodec/mediacodecdec.c | |
@@ -440,8 +440,13 @@ static int mediacodec_receive_frame(AVCodecContext *avctx, AVFrame *frame) | |
if (ret >= 0) { | |
s->buffered_pkt.size -= ret; | |
s->buffered_pkt.data += ret; | |
- if (s->buffered_pkt.size <= 0) | |
+ if (s->buffered_pkt.size <= 0) { | |
av_packet_unref(&s->buffered_pkt); | |
+ } else { | |
+ av_log(avctx, AV_LOG_WARNING, | |
+ "could not send entire packet in single input buffer (%d < %d)\n", | |
+ ret, s->buffered_pkt.size+ret); | |
+ } | |
} else if (ret < 0 && ret != AVERROR(EAGAIN)) { | |
return ret; | |
} | |
@@ -461,6 +466,7 @@ static int mediacodec_receive_frame(AVCodecContext *avctx, AVFrame *frame) | |
ret = ff_mediacodec_dec_send(avctx, s->ctx, &null_pkt, true); | |
if (ret < 0) | |
return ret; | |
+ break; | |
} else if (ret == AVERROR(EAGAIN) && s->ctx->current_input_buffer < 0) { | |
return ff_mediacodec_dec_receive(avctx, s->ctx, frame, true); | |
} else if (ret < 0) { | |
diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c | |
index 887865a281..cd289789e7 100644 | |
--- a/libavcodec/mediacodecdec_common.c | |
+++ b/libavcodec/mediacodecdec_common.c | |
@@ -568,7 +568,6 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, MediaCodecDecContext *s, | |
int offset = 0; | |
int need_draining = 0; | |
uint8_t *data; | |
- ssize_t index = s->current_input_buffer; | |
size_t size; | |
FFAMediaCodec *codec = s->codec; | |
int status; | |
@@ -590,6 +589,7 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, MediaCodecDecContext *s, | |
} | |
while (offset < pkt->size || (need_draining && !s->draining)) { | |
+ ssize_t index = s->current_input_buffer; | |
if (index < 0) { | |
index = ff_AMediaCodec_dequeueInputBuffer(codec, input_dequeue_timeout_us); | |
if (ff_AMediaCodec_infoTryAgainLater(codec, index)) { | |
@@ -611,7 +611,11 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, MediaCodecDecContext *s, | |
} | |
pts = pkt->pts; | |
- if (pts != AV_NOPTS_VALUE && avctx->pkt_timebase.num && avctx->pkt_timebase.den) { | |
+ if (pts == AV_NOPTS_VALUE) { | |
+ av_log(avctx, AV_LOG_WARNING, "Packet is missing PTS!\n"); | |
+ pts = 0; | |
+ } | |
+ if (pts && avctx->pkt_timebase.num && avctx->pkt_timebase.den) { | |
pts = av_rescale_q(pts, avctx->pkt_timebase, AV_TIME_BASE_Q); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment