[FFmpeg-cvslog] Revert "avformat/hlsenc: compute video_keyframe_size after write keyframe"
Steven Liu
git at videolan.org
Thu Oct 7 17:09:02 EEST 2021
ffmpeg | branch: release/4.4 | Steven Liu <liuqi05 at kuaishou.com> | Sat May 1 15:07:53 2021 +0800| [973899054244a7239f79453e5f4bcff235b8f6e4] | committer: Steven Liu
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 at kuaishou.com>
(cherry picked from commit 59032494e81a1a65c0b960aaae7ec4c2cc9db35a)
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=973899054244a7239f79453e5f4bcff235b8f6e4
---
libavformat/hlsenc.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 7d97ce1789..e222b70ffa 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2672,14 +2672,13 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
vs->packets_written++;
if (oc->pb) {
- int64_t keyframe_pre_pos = avio_tell(oc->pb);
ret = ff_write_chained(oc, stream_index, pkt, s, 0);
- if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) &&
- (pkt->flags & AV_PKT_FLAG_KEY) && !keyframe_pre_pos) {
- av_write_frame(oc, NULL); /* Flush any buffered data */
- vs->video_keyframe_size = avio_tell(oc->pb) - keyframe_pre_pos;
+ vs->video_keyframe_size += pkt->size;
+ if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) && (pkt->flags & AV_PKT_FLAG_KEY)) {
+ vs->video_keyframe_size = avio_tell(oc->pb);
+ } else {
+ vs->video_keyframe_pos = avio_tell(vs->out);
}
- vs->video_keyframe_pos = vs->start_pos;
if (hls->ignore_io_errors)
ret = 0;
}
More information about the ffmpeg-cvslog
mailing list