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
Unified · Split
| @@ -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 | } |