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
38#include "codec_internal.h"38#include "codec_internal.h"
39#include "decode.h"39#include "decode.h"
40#include "get_bits.h"40#include "get_bits.h"
41#include "internal.h"
41#include "vorbis.h"42#include "vorbis.h"
42#include "vorbisdsp.h"43#include "vorbisdsp.h"
43#include "vorbis_data.h"44#include "vorbis_data.h"
@@ -134,7 +135,6 @@ typedef struct vorbis_context_s { · 90 unmodified lines
134 av_tx_fn mdct_fn[2];135 av_tx_fn mdct_fn[2];
135 136
136 uint8_t first_frame;137 uint8_t first_frame;
137 int64_t initial_pts;
138 uint32_t version;138 uint32_t version;
139 uint8_t audio_channels;139 uint8_t audio_channels;
140 uint32_t audio_samplerate;140 uint32_t audio_samplerate;
@@ -1839,13 +1839,7 @@ static int vorbis_decode_frame(AVCodecContext *avctx, AVFrame *frame, · 1698 unmodified lines
1839 1839
1840 if (!vc->first_frame) {1840 if (!vc->first_frame) {
1841 vc->first_frame = 1;1841 vc->first_frame = 1;
1842 vc->initial_pts = frame->pts;1842 avctx->internal->skip_samples = len;
1843 }
1844
1845 if (frame->pts == vc->initial_pts) {
1846 *got_frame_ptr = 0;
1847 av_frame_unref(frame);
1848 return buf_size;
1849 }1843 }
1850 1844
1851 ff_dlog(NULL, "parsed %d bytes %d bits, returned %d samples (*ch*bits) \n",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 sizeof(*vc->saved));1871 sizeof(*vc->saved));
1878 }1872 }
1879 vc->previous_window = -1;1873 vc->previous_window = -1;
1874 vc->first_frame = 0;
1880}1875}
1881 1876
1882const FFCodec ff_vorbis_decoder = {1877const 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