Skip to content

Commit

Permalink
Merge d74544b into d134aec
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Apr 6, 2018
2 parents d134aec + d74544b commit 2795e98
Show file tree
Hide file tree
Showing 3 changed files with 295 additions and 83 deletions.
18 changes: 10 additions & 8 deletions toxav/toxav.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
#define WANTED_MAX_ENCODER_FPS (40)
#define MAX_ENCODE_TIME_US (1000000 / WANTED_MAX_ENCODER_FPS) // to allow x fps

#define VIDEO_SEND_X_KEYFRAMES_FIRST 7 // force the first n frames to be keyframes!

/*
VPX_DL_REALTIME (1) deadline parameter analogous to VPx REALTIME mode.
VPX_DL_GOOD_QUALITY (1000000) deadline parameter analogous to VPx GOOD QUALITY mode.
Expand Down Expand Up @@ -830,15 +828,19 @@ bool toxav_video_send_frame(ToxAV *av, uint32_t friend_number, uint16_t width, u
}

if (call->video.first->ssrc < VIDEO_SEND_X_KEYFRAMES_FIRST) {
// Key frame flag for first frames
vpx_encode_flags = VPX_EFLAG_FORCE_KF;
LOGGER_INFO(av->m->log, "I_FRAME_FLAG:%d only-i-frame mode", call->video.first->ssrc);
if (VPX_ENCODER_USED == VPX_VP8_CODEC) {
// Key frame flag for first frames
vpx_encode_flags = VPX_EFLAG_FORCE_KF;
LOGGER_INFO(av->m->log, "I_FRAME_FLAG:%d only-i-frame mode", call->video.first->ssrc);
}

call->video.first->ssrc++;
} else if (call->video.first->ssrc == VIDEO_SEND_X_KEYFRAMES_FIRST) {
// normal keyframe placement
vpx_encode_flags = 0;
LOGGER_INFO(av->m->log, "I_FRAME_FLAG:%d normal mode", call->video.first->ssrc);
if (VPX_ENCODER_USED == VPX_VP8_CODEC) {
// normal keyframe placement
vpx_encode_flags = 0;
LOGGER_INFO(av->m->log, "I_FRAME_FLAG:%d normal mode", call->video.first->ssrc);
}

call->video.first->ssrc++;
}
Expand Down

0 comments on commit 2795e98

Please sign in to comment.