mirror of
https://github.com/pion/mediadevices.git
synced 2025-10-04 16:22:46 +08:00
Implemented ForceKeyFrame for openh264 encoder (#319)
This commit is contained in:
@@ -80,6 +80,11 @@ Slice enc_encode(Encoder *e, Frame f, int *eresult) {
|
|||||||
SFrameBSInfo info = {0};
|
SFrameBSInfo info = {0};
|
||||||
Slice payload = {0};
|
Slice payload = {0};
|
||||||
|
|
||||||
|
if(e->force_key_frame == 1) {
|
||||||
|
info.eFrameType = videoFrameTypeI;
|
||||||
|
e->force_key_frame = 0;
|
||||||
|
}
|
||||||
|
|
||||||
pic.iPicWidth = f.width;
|
pic.iPicWidth = f.width;
|
||||||
pic.iPicHeight = f.height;
|
pic.iPicHeight = f.height;
|
||||||
pic.iColorFormat = videoFormatI420;
|
pic.iColorFormat = videoFormatI420;
|
||||||
|
@@ -27,6 +27,7 @@ typedef struct Encoder {
|
|||||||
ISVCEncoder *engine;
|
ISVCEncoder *engine;
|
||||||
unsigned char *buff;
|
unsigned char *buff;
|
||||||
int buff_size;
|
int buff_size;
|
||||||
|
int force_key_frame;
|
||||||
} Encoder;
|
} Encoder;
|
||||||
|
|
||||||
Encoder *enc_new(const EncoderOptions params, int *eresult);
|
Encoder *enc_new(const EncoderOptions params, int *eresult);
|
||||||
|
@@ -84,7 +84,8 @@ func (e *encoder) SetBitRate(b int) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e *encoder) ForceKeyFrame() 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 {
|
func (e *encoder) Close() error {
|
||||||
|
Reference in New Issue
Block a user