microsoft / microsoft/FFmpegInterop

Support multi-threaded decoding

Open
#3 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion
Dominant language
C++
Stars
1.4k
Forks
319
PR merge metrics
No merged PRs in 30d

Description

Really not an issue, but a request.

Certain codecs, like h264 support multi-threaded decoding. Would this be possible to support?

Here's a quick snip:

///////////////////////////////
pCodecCtx->thread_count = 4;
pCodecCtx->thread_type = FF_THREAD_FRAME;
///////////////////////////////

static int lock_manager(void **mtx, enum AVLockOp op)
    {
        switch(op) 
        {
        case AV_LOCK_CREATE:
            {
            *mtx = new CritSec();
            return 0;
            }
        case AV_LOCK_OBTAIN:
            {
            auto mutex = static_cast<CritSec*>(*mtx);
            mutex->Lock();
            return 0;
            }
        case AV_LOCK_RELEASE:
            {
            auto mutex = static_cast<CritSec*>(*mtx);
            mutex->Unlock();
            return 0;
            }
        case AV_LOCK_DESTROY:
            {
            auto mutex = static_cast<CritSec*>(*mtx);
            delete mutex;
            return 0;
            }
        }
        return 1;
    }
///////////////////////////////
av_lockmgr_register(lock_manager);

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the decoding setup and the FFmpeg AVCodecContext configuration referenced in the issue. Review how codec initialization and threading are currently handled, including the proposed lock manager. Done means supported codecs such as H.264 can decode with multiple threads without breaking existing decoding behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
audio-video-rtc
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.