Index: libavformat/rtmpproto.c =================================================================== --- libavformat/rtmpproto.c (revision 26402) +++ libavformat/rtmpproto.c (working copy) @@ -930,8 +930,8 @@ int pktsize, pkttype; uint32_t ts; const uint8_t *buf_temp = buf; - - if (size < 11) { + // rt->flv_off will never be always zero if there are multiple rtmp packets inside one flv packet + if (!rt->flv_off && size < 11) { av_log(LOG_CONTEXT, AV_LOG_DEBUG, "FLV packet too small %d\n", size); return 0; } @@ -972,8 +972,12 @@ if (rt->flv_size - rt->flv_off > size_temp) { bytestream_get_buffer(&buf_temp, rt->flv_data + rt->flv_off, size_temp); rt->flv_off += size_temp; + // Making size_temp = 0 when it reads full of buffer + size_temp = 0; } else { bytestream_get_buffer(&buf_temp, rt->flv_data + rt->flv_off, rt->flv_size - rt->flv_off); + // Reducing size_temp by as many bytes as read from the buffer + size_temp -= (rt->flv_size - rt->flv_off); rt->flv_off += rt->flv_size - rt->flv_off; }