-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
force key frame implementation for vaapi #437
Changes from 3 commits
5190ac0
ecd1f93
03f6b64
dd9582e
410e856
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,6 +100,8 @@ type encoderVP8 struct { | |
|
||
rate *framerateDetector | ||
|
||
forceKeyFrame bool | ||
|
||
mu sync.Mutex | ||
closed bool | ||
} | ||
|
@@ -315,7 +317,7 @@ func (e *encoderVP8) Read() ([]byte, func(), error) { | |
|
||
e.frParam.data.framerate = C.uint(e.rate.Calc()) | ||
|
||
if kf { | ||
if kf || e.forceKeyFrame { | ||
// Key frame | ||
C.setForceKFFlagVP8(&e.picParam, 1) | ||
C.setFrameTypeFlagVP8(&e.picParam, 0) | ||
|
@@ -545,6 +547,10 @@ func (e *encoderVP8) Controller() codec.EncoderController { | |
return e | ||
} | ||
|
||
func (e *encoderVP8) ForceKeyFrame() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This interface has been replaced by There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand, this function method already exists and returns the encoder itself. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also don't remember what I wanted to point and old CI log is gone. |
||
e.forceKeyFrame = true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It may cause data race if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've changed the type to use an |
||
} | ||
|
||
func (e *encoderVP8) Close() error { | ||
e.mu.Lock() | ||
defer e.mu.Unlock() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forceKeyFrame
isn't reset, so every frames afterForceKeyFrame()
will be keyframe.