Skip to content

Fix: not working on android 16/oneplus 15. Also fix an issue where image was blurry due to bit rate error. - #8

Merged
snap24 merged 3 commits into
snap24:mainfrom
Xnick417x:blur
Aug 2, 2026
Merged

Fix: not working on android 16/oneplus 15. Also fix an issue where image was blurry due to bit rate error.#8
snap24 merged 3 commits into
snap24:mainfrom
Xnick417x:blur

Conversation

@Xnick417x

Copy link
Copy Markdown
Contributor

Hello this application is amazing. Unfortunately it wasn't working on my oneplus 15. I fixed a few things even fixed a mic spam in recording that did cause a little cpu overhead. It works great on my device now. It's amazing no cpu over head and only 100mb of ram used. What a great app. Thanks man.

A session never unregistered its MediaProjection.Callback or stopped the
projection, so starting a new capture made the system stop the old one and
dispatch onStop to the leaked callback. That dispatch was queued on the main
looper while startRecording ran, landing 1-2ms after the new session came up
and immediately stopping it, which produced empty mp4 files.

- Unregister the callback and stop the projection in RecordingSession.stop(),
  guarded by a released flag so a queued onStop cannot kill a newer session
- Build the FloatingController inline instead of posting it, so stopRecording
  can dismiss it; the posted version was created after teardown and left an
  orphaned bubble whose timer counted forever
- Wrap the overlay addView in try/catch and stop the timer when not showing
- Drop PUBLIC and PRESENTATION from the VirtualDisplay flags, which made the
  system treat it as a real secondary display and attach a nav bar to it
- Release a leftover session before starting a new one, stop the service when
  MediaProjection is unavailable, and clear state in onDestroy
- Watchdog stepped Native to 4K instead of down; send it to 1080p
- Skip BUFFER_FLAG_CODEC_CONFIG buffers instead of muxing them as a frame
Native captures were soft after every app switch. A flat 8 Mbps across
1264x2768 at 60fps is roughly 0.04 bits per pixel per frame, so a scene change
forced an I-frame the CBR budget could not pay for and the picture only
sharpened once the scene went static again.

- Floor the bitrate at width * height * fps * bits-per-pixel, 0.10 for AVC and
  0.07 for HEVC and AV1, capped at 40 Mbps and never below the user's own pick
- Brush red exit now minimises: the toolbar closes but the strokes stay, and
  only the clear button erases them. Reopening from the bubble restores them
- Mark the drawing overlay not-touchable while minimised so it stops swallowing
  every touch on the device
- Reuse the audio mixing scratch arrays instead of allocating them per read
Choosing AV1 on a device with no hardware AV1 encoder made
createEncoderByType return the libaom software encoder. It cannot keep up with
screen capture, so the achieved frame rate fell far below the requested one,
the device stuttered while recording, and the finished file reported the
average it managed rather than the rate that was asked for.

- Reject encoders that are not hardware accelerated, letting the existing
  fallback ladder move on to a codec the device can encode in hardware
- Allow a software encoder only on the final last-resort attempt, so a device
  with no hardware encoder at all can still record
- Warn when the codec in use is not the one selected, since falling back
  silently is what makes the recorded frame rate look wrong
@snap24

snap24 commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Hey @Xnick417x ,
Thanks a lot for these great updates and bug fixes! I’ve reviewed the code changes and they look really solid and well-optimized , I will be merging this PR soon.
Thanks again for your valuable contribution and effort!

@snap24
snap24 merged commit 78a3599 into snap24:main Aug 2, 2026
snap24 added a commit that referenced this pull request Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants