History

avcodec/mediacodecdec: warn when input buffers are not configured with proper size

In rare circumstances, if the codec is not configured with the proper parameters the input buffers can be allocated with a size that's too small to hold an individual packet. Since MediaCodec expects exactly one incoming buffer with a given PTS, it is not valid to split data for a given PTS across two input buffers. See https://developer.android.com/reference/android/media/MediaCodec#data-processing: > Do not submit multiple input buffers with the same timestamp

Aman Gupta committed 7 years ago

Commit 8a3623e1 parent e26fb6a1 file · +6 −1Browse files

Unified · Split

libavcodec/mediacodecdec.c+6−1
@@ -440,8 +440,13 @@ static int mediacodec_receive_frame(AVCodecContext *avctx, AVFrame *frame) · 439 unmodified lines
440 if (ret >= 0) {440 if (ret >= 0) {
441 s->buffered_pkt.size -= ret;441 s->buffered_pkt.size -= ret;
442 s->buffered_pkt.data += ret;442 s->buffered_pkt.data += ret;
443 if (s->buffered_pkt.size <= 0)443 if (s->buffered_pkt.size <= 0) {
444 av_packet_unref(&s->buffered_pkt);444 av_packet_unref(&s->buffered_pkt);
445 } else {
446 av_log(avctx, AV_LOG_WARNING,
447 "could not send entire packet in single input buffer (%d < %d)\n",
448 ret, s->buffered_pkt.size+ret);
449 }
445 } else if (ret < 0 && ret != AVERROR(EAGAIN)) {450 } else if (ret < 0 && ret != AVERROR(EAGAIN)) {
446 return ret;451 return ret;
447 }452 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t