react-native-webrtc icon indicating copy to clipboard operation
react-native-webrtc copied to clipboard

Multiple video frame processors + implementation for ios

Open 8BallBomBom opened this issue 8 months ago • 8 comments

Original pr and commits by wjaykim over here #1331 Decided to just grab everything and make sure things were up to date with the master branch. Saves a lot of the previous mess, my bad.

Should be all good but always best to test. We don't currently have an example for iOS but there is one in the old pr for Android.

8BallBomBom avatar Mar 08 '25 02:03 8BallBomBom

Sorry i have question, can i use methods for frame processing in swift module. If i install webrtc from videoeffects branch or i have to wait until accept this pr?

AleanM avatar Mar 14 '25 09:03 AleanM

AlKor13 avatar Mar 20 '25 12:03 AlKor13

Hi @8BallBomBom,

Thank you for this PR!

if you are interested, I would like to sponsor this feature, could you please let me know how I can do that?

magiccDev avatar Apr 18 '25 06:04 magiccDev

Would need to talk with @saghul about that 🤔 and the original commit was by @wjaykim

8BallBomBom avatar Apr 18 '25 14:04 8BallBomBom

I'll try to make a example use of the processor when possible. It's been a while after I initially made the pull request(and I'm not working on webrtc related projects now), so I have to realign the current codebases.

wjaykim avatar Apr 19 '25 04:04 wjaykim

Thank you! Nothing has significantly changed, at least ;-)

saghul avatar Apr 20 '25 08:04 saghul

I think the changes in VideoEffectProcessor.java, specifically onFrameCaptured function has introduced a bug where frames are not sent back to webrtc resulting in black screen. I modified the code to pick just the first processor, used the old logic and it fixed the problem.

        frame.retain();
        VideoFrameProcessor firstProcessor = videoFrameProcessors.get(0);
        VideoFrame outputFrame = firstProcessor.process(frame, textureHelper);
        if(outputFrame==null){
            mSink.onFrame(frame);
            frame.release();
            return;
        }
        mSink.onFrame(outputFrame);
        outputFrame.release();
        frame.release();

also, while looping through the list of processors shouldn't we use the last valid frame returned by a processor? Current code uses the original frame.

anilgupta83 avatar May 05 '25 02:05 anilgupta83

I added simple video frame processor example here.

wjaykim avatar May 05 '25 13:05 wjaykim

@8BallBomBom are you ready with this?

saghul avatar Jun 26 '25 08:06 saghul

Should be good to go. Left out changing the capturer to the base class but that could be addressed.

@anilgupta83 I never managed to reproduce the issue you experienced.

8BallBomBom avatar Jun 26 '25 16:06 8BallBomBom

@8BallBomBom Thanks! Can you run npm run format so the style is checked and then commit the result and land it?

saghul avatar Jun 27 '25 09:06 saghul

Done and done.

8BallBomBom avatar Jun 27 '25 21:06 8BallBomBom

@anilgupta83 I never managed to reproduce the issue you experienced.

Probably something wrong with my processor code, it has changed since then. I have tested the changes you have merged and it works as expected. Kudos!

anilgupta83 avatar Jun 28 '25 04:06 anilgupta83