You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
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 8fc2dedfe6
, 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.
Suggested-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
@@ -38,6 +38,7 @@
|
|||||||
#include "codec_internal.h"
|
#include "codec_internal.h"
|
||||||
#include "decode.h"
|
#include "decode.h"
|
||||||
#include "get_bits.h"
|
#include "get_bits.h"
|
||||||
|
#include "internal.h"
|
||||||
#include "vorbis.h"
|
#include "vorbis.h"
|
||||||
#include "vorbisdsp.h"
|
#include "vorbisdsp.h"
|
||||||
#include "vorbis_data.h"
|
#include "vorbis_data.h"
|
||||||
@@ -134,7 +135,6 @@ typedef struct vorbis_context_s {
|
|||||||
av_tx_fn mdct_fn[2];
|
av_tx_fn mdct_fn[2];
|
||||||
|
|
||||||
uint8_t first_frame;
|
uint8_t first_frame;
|
||||||
int64_t initial_pts;
|
|
||||||
uint32_t version;
|
uint32_t version;
|
||||||
uint8_t audio_channels;
|
uint8_t audio_channels;
|
||||||
uint32_t audio_samplerate;
|
uint32_t audio_samplerate;
|
||||||
@@ -1839,13 +1839,7 @@ static int vorbis_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
|||||||
|
|
||||||
if (!vc->first_frame) {
|
if (!vc->first_frame) {
|
||||||
vc->first_frame = 1;
|
vc->first_frame = 1;
|
||||||
vc->initial_pts = frame->pts;
|
avctx->internal->skip_samples = len;
|
||||||
}
|
|
||||||
|
|
||||||
if (frame->pts == vc->initial_pts) {
|
|
||||||
*got_frame_ptr = 0;
|
|
||||||
av_frame_unref(frame);
|
|
||||||
return buf_size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ff_dlog(NULL, "parsed %d bytes %d bits, returned %d samples (*ch*bits) \n",
|
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)
|
|||||||
sizeof(*vc->saved));
|
sizeof(*vc->saved));
|
||||||
}
|
}
|
||||||
vc->previous_window = -1;
|
vc->previous_window = -1;
|
||||||
|
vc->first_frame = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FFCodec ff_vorbis_decoder = {
|
const FFCodec ff_vorbis_decoder = {
|
||||||
|
Reference in New Issue
Block a user