mirror of
https://github.com/mpv-player/mpv
synced 2025-03-29 15:00:27 +00:00
encode: restore audio muxer timebase use
Seems to crash hard if an error happens somewhere at init. Who cares. Part of #7524.
This commit is contained in:
parent
b572f116da
commit
de53155971
@ -87,6 +87,9 @@ static void select_format(struct ao *ao, const AVCodec *codec)
|
||||
static void on_ready(void *ptr)
|
||||
{
|
||||
struct ao *ao = ptr;
|
||||
struct priv *ac = ao->priv;
|
||||
|
||||
ac->worst_time_base = encoder_get_mux_timebase_unlocked(ac->enc);
|
||||
|
||||
ao_add_events(ao, AO_EVENT_INITIAL_UNBLOCK);
|
||||
}
|
||||
|
@ -491,6 +491,11 @@ done:
|
||||
av_packet_unref(pkt);
|
||||
}
|
||||
|
||||
AVRational encoder_get_mux_timebase_unlocked(struct encoder_context *p)
|
||||
{
|
||||
return p->mux_stream->st->time_base;
|
||||
}
|
||||
|
||||
void encode_lavc_discontinuity(struct encode_lavc_context *ctx)
|
||||
{
|
||||
if (!ctx)
|
||||
|
@ -111,6 +111,10 @@ bool encoder_init_codec_and_muxer(struct encoder_context *p,
|
||||
// Encode the frame and write the packet. frame is ref'ed as need.
|
||||
bool encoder_encode(struct encoder_context *p, AVFrame *frame);
|
||||
|
||||
// Return muxer timebase (only available after on_ready() has been called).
|
||||
// Caller needs to acquire encode_lavc_context.lock (or call it from on_ready).
|
||||
AVRational encoder_get_mux_timebase_unlocked(struct encoder_context *p);
|
||||
|
||||
double encoder_get_offset(struct encoder_context *p);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user