Commit b47d015
fix(replay): Release MediaMuxer when no frames are encoded
The MediaMuxer is created when the video encoder is constructed, but its
release() was reachable only on the happy path. Two cases leaked it:
- createVideoOf returned early when frameCount was 0 without releasing the
encoder.
- SimpleMp4FrameMuxer.release() called muxer.stop() before muxer.release().
stop() throws if the muxer was never started (no frame ever muxed), so
release() was skipped.
This surfaced as a CloseGuard "resource was acquired but never released"
warning. Guard stop() behind the started flag so release() is always
reached, and release the encoder on the no-frames return path.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 05aa61d commit b47d015
2 files changed
Lines changed: 9 additions & 1 deletion
File tree
- sentry-android-replay/src/main/java/io/sentry/android/replay
- video
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
202 | 206 | | |
203 | 207 | | |
204 | 208 | | |
| |||
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
71 | 75 | | |
72 | 76 | | |
73 | 77 | | |
| |||
0 commit comments