1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-06-09 14:07:31 +02:00

Revert "avformat/hlsenc: compute video_keyframe_size after write keyframe"

This reverts commit b5ca8f2c66954614d81579082025f580efc0cffc.

This commit will make new problem about tickets: 9193,9205
It flush data into file with init file context together,
and it can get keyframe size, maybe need more method to get keyframe
size.

Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
This commit is contained in:
Steven Liu 2021-05-01 15:07:53 +08:00
parent c9a79532e5
commit 59032494e8

View File

@ -2650,14 +2650,13 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
vs->packets_written++; vs->packets_written++;
if (oc->pb) { if (oc->pb) {
int64_t keyframe_pre_pos = avio_tell(oc->pb);
ret = ff_write_chained(oc, stream_index, pkt, s, 0); ret = ff_write_chained(oc, stream_index, pkt, s, 0);
if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) && vs->video_keyframe_size += pkt->size;
(pkt->flags & AV_PKT_FLAG_KEY) && !keyframe_pre_pos) { if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) && (pkt->flags & AV_PKT_FLAG_KEY)) {
av_write_frame(oc, NULL); /* Flush any buffered data */ vs->video_keyframe_size = avio_tell(oc->pb);
vs->video_keyframe_size = avio_tell(oc->pb) - keyframe_pre_pos; } else {
vs->video_keyframe_pos = avio_tell(vs->out);
} }
vs->video_keyframe_pos = vs->start_pos;
if (hls->ignore_io_errors) if (hls->ignore_io_errors)
ret = 0; ret = 0;
} }