t_info.keyframe_granule_shift is set to the library default of 6, which is ok for gop sizes up to 63. Since there's apparently no way to query the updated value after having forced a gop value with TH_ENCCTL_SET_KEYFRAME_FREQUENCY_FORCE, calculate it manually instead. Fixes ticket #11454.
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -234,7 +234,7 @@ static av_cold int encode_init(AVCodecContext* avc_context) · 233 unmodified lines | ||
| 234 | 234 | return AVERROR_EXTERNAL; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | − h->keyframe_mask = (1 << t_info.keyframe_granule_shift) - 1; | |
| 237 | + h->keyframe_mask = (1 << av_ceil_log2(avc_context->gop_size)) - 1; | |
| 238 | 238 | /* Clear up theora_info struct */ |
| 239 | 239 | th_info_clear(&t_info); |
| 240 | 240 | |