]> git.sesse.net Git - nageru/blobdiff - httpd.cpp
Start a mux only on a keyframe, so that transcoding clients do not get too confused.
[nageru] / httpd.cpp
index b9b1d6f10fe7a920b836e45a4531977dbcb2af24..6a92699936c45ef3a0c324064512af69abd2d2b8 100644 (file)
--- a/httpd.cpp
+++ b/httpd.cpp
@@ -196,6 +196,12 @@ HTTPD::Mux::~Mux()
 
 void HTTPD::Mux::add_packet(const AVPacket &pkt, int64_t pts, int64_t dts)
 {
+       if (!seen_keyframe && !(pkt.stream_index == 0 && (pkt.flags & AV_PKT_FLAG_KEY))) {
+               // Wait until we see the first (video) key frame.
+               return;
+       }
+       seen_keyframe = true;
+
        AVPacket pkt_copy;
        av_copy_packet(&pkt_copy, &pkt);
        if (pkt.stream_index == 0) {