History

avcodec/vorbisdec: export skip_samples instead of dropping frames

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.

James Almer committed 3 years ago

Commit cbcc8171 parent 37cde571 file · +3 −8Browse files

Unified · Split

libavcodec/vorbisdec.c+3−8
@@ -38,6 +38,7 @@ · 37 unmodified lines
3838 #include "codec_internal.h"
3939 #include "decode.h"
4040 #include "get_bits.h"
41+#include "internal.h"
4142 #include "vorbis.h"
4243 #include "vorbisdsp.h"
4344 #include "vorbis_data.h"
@@ -134,7 +135,6 @@ typedef struct vorbis_context_s { · 90 unmodified lines
134135 av_tx_fn mdct_fn[2];
135136
136137 uint8_t first_frame;
137− int64_t initial_pts;
138138 uint32_t version;
139139 uint8_t audio_channels;
140140 uint32_t audio_samplerate;
@@ -1839,13 +1839,7 @@ static int vorbis_decode_frame(AVCodecContext *avctx, AVFrame *frame, · 1698 unmodified lines
18391839
18401840 if (!vc->first_frame) {
18411841 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;
18491843 }
18501844
18511845 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
18771871 sizeof(*vc->saved));
18781872 }
18791873 vc->previous_window = -1;
1874+ vc->first_frame = 0;
18801875 }
18811876
18821877 const FFCodec ff_vorbis_decoder = {

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