pts may not be set on input packets, which could result in the entire stream being discarded. This reverts commit 8fc2dedfe6e8fcc58dd052bf3b85cd4754133b17, reintroducing the behavior it replaced but now allowing the caller to manually drop the preroll samples by looking at the skip_samples side data at the start while ignoring it on seek, by setting the skip_manual avctx flag. Fixes ticket #10251.
Unified · Split
| @@ -38,6 +38,7 @@ · 37 unmodified lines | ||
| 38 | 38 | #include "codec_internal.h" |
| 39 | 39 | #include "decode.h" |
| 40 | 40 | #include "get_bits.h" |
| 41 | +#include "internal.h" | |
| 41 | 42 | #include "vorbis.h" |
| 42 | 43 | #include "vorbisdsp.h" |
| 43 | 44 | #include "vorbis_data.h" |
| @@ -134,7 +135,6 @@ typedef struct vorbis_context_s { · 90 unmodified lines | ||
| 134 | 135 | av_tx_fn mdct_fn[2]; |
| 135 | 136 | |
| 136 | 137 | uint8_t first_frame; |
| 137 | − int64_t initial_pts; | |
| 138 | 138 | uint32_t version; |
| 139 | 139 | uint8_t audio_channels; |
| 140 | 140 | uint32_t audio_samplerate; |
| @@ -1839,13 +1839,7 @@ static int vorbis_decode_frame(AVCodecContext *avctx, AVFrame *frame, · 1698 unmodified lines | ||
| 1839 | 1839 | |
| 1840 | 1840 | if (!vc->first_frame) { |
| 1841 | 1841 | vc->first_frame = 1; |
| 1842 | − vc->initial_pts = frame->pts; | |
| 1843 | − } | |
| 1844 | − | |
| 1845 | − if (frame->pts == vc->initial_pts) { | |
| 1846 | − *got_frame_ptr = 0; | |
| 1847 | − av_frame_unref(frame); | |
| 1848 | − return buf_size; | |
| 1842 | + avctx->internal->skip_samples = len; | |
| 1849 | 1843 | } |
| 1850 | 1844 | |
| 1851 | 1845 | ff_dlog(NULL, "parsed %d bytes %d bits, returned %d samples (*ch*bits) \n", |
| @@ -1877,6 +1871,7 @@ static av_cold void vorbis_decode_flush(AVCodecContext *avctx) · 25 unmodified lines | ||
| 1877 | 1871 | sizeof(*vc->saved)); |
| 1878 | 1872 | } |
| 1879 | 1873 | vc->previous_window = -1; |
| 1874 | + vc->first_frame = 0; | |
| 1880 | 1875 | } |
| 1881 | 1876 | |
| 1882 | 1877 | const FFCodec ff_vorbis_decoder = { |