Implemented ForceKeyFrame for openh264 encoder (#319)

This commit is contained in:
Patryk Rogalski
2021-03-12 23:26:30 +00:00
committed by GitHub
parent 6411b00e93
commit b863c105c8
3 changed files with 8 additions and 1 deletions

View File

@@ -80,6 +80,11 @@ Slice enc_encode(Encoder *e, Frame f, int *eresult) {
SFrameBSInfo info = {0};
Slice payload = {0};
if(e->force_key_frame == 1) {
info.eFrameType = videoFrameTypeI;
e->force_key_frame = 0;
}
pic.iPicWidth = f.width;
pic.iPicHeight = f.height;
pic.iColorFormat = videoFormatI420;

View File

@@ -27,6 +27,7 @@ typedef struct Encoder {
ISVCEncoder *engine;
unsigned char *buff;
int buff_size;
int force_key_frame;
} Encoder;
Encoder *enc_new(const EncoderOptions params, int *eresult);

View File

@@ -84,7 +84,8 @@ func (e *encoder) SetBitRate(b int) error {
}
func (e *encoder) ForceKeyFrame() error {
panic("ForceKeyFrame is not implemented")
e.engine.force_key_frame = C.int(1)
return nil
}
func (e *encoder) Close() error {