Skip to content

Commit 93374f7

Browse files
committed
force pixel format for mediacodec
1 parent c74e340 commit 93374f7

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/recorder.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ geode::Result<> Recorder::Impl::init(const RenderSettings& settings) {
7373

7474
if (const AVPixelFormat *pix_fmt = m_codec->pix_fmts) {
7575
while (*pix_fmt != AV_PIX_FMT_NONE) {
76+
if(*pix_fmt == AV_PIX_FMT_MEDIACODEC) {
77+
// secretly force pix fmt to nv12. seems to work contrary to yuv420p.
78+
// with AV_PIX_FMT_MEDIACODEC mediacodec would go into surface mode and expect a surface
79+
m_codecContext->pix_fmt = AV_PIX_FMT_NV12;
80+
break;
81+
}
7682
if(*pix_fmt == static_cast<AVPixelFormat>(settings.m_pixelFormat))
7783
m_codecContext->pix_fmt = *pix_fmt;
7884
++pix_fmt;

0 commit comments

Comments
 (0)