Fix vpx encoding

This commit is contained in:
mid 2025-10-12 16:57:58 +03:00
parent 8b78f0cdf7
commit 28e7fa3365
2 changed files with 14 additions and 3 deletions

View File

@ -344,8 +344,16 @@ static int muxmkv_perform(CHiPubNode *pubn) {
assert((frame->flags & CUTIHI_BS_SETUP_PACKET) == 0);
bool freeAvcc = false;
size_t avccSz = 0;
uint8_t *avcc = annexb_to_avcc(frame->ptr, frame->sz, &avccSz);
uint8_t *avcc = NULL;
if(CHi_Crawl(&pubn->sinks[0])->type == CUTIHI_VAL_H264BS) {
avcc = annexb_to_avcc(frame->ptr, frame->sz, &avccSz);
freeAvcc = true;
} else {
avcc = frame->ptr;
avccSz = frame->sz;
}
size_t simpleBlockSize = 4 + avccSz;
@ -360,7 +368,10 @@ static int muxmkv_perform(CHiPubNode *pubn) {
ebml_writer_put(&this->wr, 0xA3, EBML_BINARY, (EBMLPrimitive) {.binary = {.length = simpleBlockSize, .ptr = simpleBlock}});
free(simpleBlock);
free(avcc);
if(freeAvcc) {
free(avcc);
}
CHi_BS_Pop(this->videoBacklog, 1);
}

View File

@ -42,7 +42,7 @@ static int encodevpx_perform(CHiPubNode *pub) {
MTR_BEGIN("CHi", "encodevp9_perform");
pub->sources[0].type = CUTIHI_VAL_VP9BS;
pub->sources[0].type = pub->type == CUTIHI_T('CEnc','GVP8') ? CUTIHI_VAL_VP8BS : CUTIHI_VAL_VP9BS;
pub->sources[0].data.bitstream = NULL;
if(node->state == WAITING) return 1;