Fix prolonged blank screen when reacting to idr events

This commit is contained in:
loki 2020-01-19 14:31:55 +01:00
parent ee067f4d8a
commit 35e21eb3af
2 changed files with 5 additions and 6 deletions

View File

@ -996,7 +996,6 @@ void cmd_announce(host_t &host, peer_t peer, msg_t &&req) {
session.audio_packets = std::make_shared<audio::packet_queue_t::element_type>();
video::idr_event_t idr_events {new video::idr_event_t::element_type };
idr_events->raise(std::pair<std::int64_t, std::int64_t> { 1, 13 });
session.audioThread = std::thread {audioThread};
session.videoThread = std::thread {videoThread, idr_events};

View File

@ -147,8 +147,8 @@ void encodeThread(
av_frame_get_buffer(yuv_frame.get(), 0);
int64_t frame = 0;
int64_t key_frame = 0;
int64_t frame = 1;
int64_t key_frame = 1;
auto img_width = 0;
auto img_height = 0;
@ -175,10 +175,10 @@ void encodeThread(
yuv_frame->pict_type = AV_PICTURE_TYPE_I;
auto event = idr_events->pop();
TUPLE_2D_REF(start, end, *event);
TUPLE_2D_REF(_, end, *event);
frame = start;
key_frame = end + 2;
frame = end;
key_frame = end + config.framerate;
}
else if(frame == key_frame) {
yuv_frame->pict_type = AV_PICTURE_TYPE_I;