Commit 4a51075f authored by Paul B Mahol's avatar Paul B Mahol

doc/examples/muxing: fix underflow in duration of encoded streams

Now they are exactly 10 seconds long.

Fixes #5684.
parent 1929dd4e
...@@ -285,7 +285,7 @@ static AVFrame *get_audio_frame(OutputStream *ost) ...@@ -285,7 +285,7 @@ static AVFrame *get_audio_frame(OutputStream *ost)
/* check if we want to generate more frames */ /* check if we want to generate more frames */
if (av_compare_ts(ost->next_pts, ost->enc->time_base, if (av_compare_ts(ost->next_pts, ost->enc->time_base,
STREAM_DURATION, (AVRational){ 1, 1 }) >= 0) STREAM_DURATION, (AVRational){ 1, 1 }) > 0)
return NULL; return NULL;
for (j = 0; j <frame->nb_samples; j++) { for (j = 0; j <frame->nb_samples; j++) {
...@@ -464,7 +464,7 @@ static AVFrame *get_video_frame(OutputStream *ost) ...@@ -464,7 +464,7 @@ static AVFrame *get_video_frame(OutputStream *ost)
/* check if we want to generate more frames */ /* check if we want to generate more frames */
if (av_compare_ts(ost->next_pts, c->time_base, if (av_compare_ts(ost->next_pts, c->time_base,
STREAM_DURATION, (AVRational){ 1, 1 }) >= 0) STREAM_DURATION, (AVRational){ 1, 1 }) > 0)
return NULL; return NULL;
/* when we pass a frame to the encoder, it may keep a reference to it /* when we pass a frame to the encoder, it may keep a reference to it
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment