History

ffmpeg: use reordered duration for stream PTS.

Nicolas George committed 9 years ago

Commit 36c111c1 parent dfed8e21 file · +5 −3Browse files

Unified · Split

ffmpeg.c+5−3
@@ -2368,7 +2368,7 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output, · 2367 unmodified lines
23682368 return err < 0 ? err : ret;
23692369 }
23702370
2371−static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output, int eof,
2371+static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output, int64_t *duration_pts, int eof,
23722372 int *decode_failed)
23732373 {
23742374 AVFrame *decoded_frame;
@@ -2459,6 +2459,7 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output, int eo · 84 unmodified lines
24592459 ist->hwaccel_retrieved_pix_fmt = decoded_frame->format;
24602460
24612461 best_effort_timestamp= decoded_frame->best_effort_timestamp;
2462+ *duration_pts = decoded_frame->pkt_duration;
24622463
24632464 if (ist->framerate.num)
24642465 best_effort_timestamp = ist->cfr_next_pts++;
@@ -2629,6 +2630,7 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo · 164 unmodified lines
26292630 // while we have more to decode or while the decoder did output something on EOF
26302631 while (ist->decoding_needed) {
26312632 int64_t duration_dts = 0;
2633+ int64_t duration_pts = 0;
26322634 int got_output = 0;
26332635 int decode_failed = 0;
26342636
@@ -2641,7 +2643,7 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo · 6 unmodified lines
26412643 &decode_failed);
26422644 break;
26432645 case AVMEDIA_TYPE_VIDEO:
2644− ret = decode_video (ist, repeating ? NULL : &avpkt, &got_output, !pkt,
2646+ ret = decode_video (ist, repeating ? NULL : &avpkt, &got_output, &duration_pts, !pkt,
26452647 &decode_failed);
26462648 if (!repeating || !pkt || got_output) {
26472649 if (pkt && pkt->duration) {
@@ -2660,7 +2662,7 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo · 12 unmodified lines
26602662 }
26612663
26622664 if (got_output)
2663− ist->next_pts += duration_dts; //FIXME the duration is not correct in some cases
2665+ ist->next_pts += av_rescale_q(duration_pts, ist->st->time_base, AV_TIME_BASE_Q);
26642666 break;
26652667 case AVMEDIA_TYPE_SUBTITLE:
26662668 if (repeating)

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