diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 95a41bbbc6aaaa53da2f702608d28f13306adca1..7a73a1791f974598561468dbf0bf914fa7811b38 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -538,6 +538,13 @@ int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size)
 
     len = s->buf_end - s->buf_ptr;
     if (len == 0) {
+        /* Reset the buf_end pointer to the start of the buffer, to make sure
+         * the fill_buffer call tries to read as much data as fits into the
+         * full buffer, instead of just what space is left after buf_end.
+         * This avoids returning partial packets at the end of the buffer,
+         * for packet based inputs.
+         */
+        s->buf_end = s->buf_ptr = s->buffer;
         fill_buffer(s);
         len = s->buf_end - s->buf_ptr;
     }
diff --git a/libavresample/avresample.h b/libavresample/avresample.h
index 34998aa0cc1688989690c3b960765dcb84b86612..0012787404a330ca6cb43fff7542d2a190077457 100644
--- a/libavresample/avresample.h
+++ b/libavresample/avresample.h
@@ -49,7 +49,7 @@
  * av_opt_set_int(avr, "in_sample_rate",     48000,                0);
  * av_opt_set_int(avr, "out_sample_rate",    44100,                0);
  * av_opt_set_int(avr, "in_sample_fmt",      AV_SAMPLE_FMT_FLTP,   0);
- * av_opt_set_int(avr, "out_sample_fmt,      AV_SAMPLE_FMT_S16,    0);
+ * av_opt_set_int(avr, "out_sample_fmt",     AV_SAMPLE_FMT_S16,    0);
  * @endcode
  *
  * Once the context is initialized, it must be opened with avresample_open(). If