-
Notifications
You must be signed in to change notification settings - Fork 125
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 all 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 |
---|---|---|
|
@@ -62,6 +62,7 @@ import ( | |
"image" | ||
"io" | ||
"sync" | ||
"sync/atomic" | ||
"unsafe" | ||
|
||
"github.com/pion/mediadevices/pkg/codec" | ||
|
@@ -100,6 +101,8 @@ type encoderVP8 struct { | |
|
||
rate *framerateDetector | ||
|
||
forceKeyFrame atomic.Bool | ||
|
||
mu sync.Mutex | ||
closed bool | ||
} | ||
|
@@ -316,7 +319,7 @@ func (e *encoderVP8) Read() ([]byte, func(), error) { | |
|
||
e.frParam.data.framerate = C.uint(e.rate.Calc()) | ||
|
||
if kf { | ||
if kf || e.forceKeyFrame.CompareAndSwap(true, false) { | ||
// Key frame | ||
C.setForceKFFlagVP8(&e.picParam, 1) | ||
C.setFrameTypeFlagVP8(&e.picParam, 0) | ||
|
@@ -546,6 +549,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.Store(true) | ||
} | ||
|
||
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.
Need to bump minimal supported go version to 1.19
mediadevices/go.mod
Line 3 in b4770e5