Skip to content

Commit

Permalink
ff_ffplay: merge: e32857f30eed011e6c49d578418692f54d8e9a5d
Browse files Browse the repository at this point in the history
    ffplay: ensure that we buffer at least 1 second of content

    In order to do that, we keep track of the total duration of packets in a pac
ket
    queue.

    Signed-off-by: Marton Balint <[email protected]>
  • Loading branch information
bbcallen committed Jul 14, 2016
1 parent 07eb506 commit af2b2ac
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ijkmedia/ijkplayer/ff_ffplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,7 @@ static int packet_queue_put_private(PacketQueue *q, AVPacket *pkt)
q->last_pkt = pkt1;
q->nb_packets++;
q->size += pkt1->pkt.size + sizeof(*pkt1);
if (pkt1->pkt.duration > 0)
q->duration += pkt1->pkt.duration;
q->duration += pkt1->pkt.duration;
/* XXX: should duplicate packet data in DV case */
SDL_CondSignal(q->cond);
return 0;
Expand Down Expand Up @@ -296,8 +295,7 @@ static int packet_queue_get(PacketQueue *q, AVPacket *pkt, int block, int *seria
q->last_pkt = NULL;
q->nb_packets--;
q->size -= pkt1->pkt.size + sizeof(*pkt1);
if (pkt1->pkt.duration > 0)
q->duration -= pkt1->pkt.duration;
q->duration -= pkt1->pkt.duration;
*pkt = pkt1->pkt;
if (serial)
*serial = pkt1->serial;
Expand Down Expand Up @@ -2370,6 +2368,9 @@ static int stream_has_enough_packets(AVStream *st, int stream_id, PacketQueue *q
return stream_id < 0 ||
queue->abort_request ||
(st->disposition & AV_DISPOSITION_ATTACHED_PIC) ||
#ifdef FFP_MERGE
queue->nb_packets > MIN_FRAMES && (!queue->duration || av_q2d(st->time_base) * queue->duration > 1.0);
#endif
queue->nb_packets > min_frames;
}

Expand Down

0 comments on commit af2b2ac

Please sign in to comment.