Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Update MP4Clip class to use fileToMP4Samples for parsing MP4 streams #186

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

wendraw
Copy link

@wendraw wendraw commented Jul 18, 2024

关联的 issue:#129

尝试使用 OPFSToolFile 来分段解析 mp4 buffer 为 samples.

Copy link

changeset-bot bot commented Jul 18, 2024

⚠️ No Changeset found

Latest commit: 8e0b654

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@wendraw
Copy link
Author

wendraw commented Jul 22, 2024

添加一些测试用来说明内存问题得以解决:

  • 测试视频:
    • 3.5GB 的电影 《星际穿越》 (🚫🚫🚫说明该文件只用作学习交流用,不可用作其他商业用途)
    • 其他大小的视频可以用 ffmpeg 裁剪出来
  • 测试环境:
    • Google Chrome Version 126.0.6478.183 (Official Build) (arm64)
    • MacBook Pro 16G Apple M1(14.5 (23F79))
  • 测试页面: http://localhost:6066/decode-media.html

before(main 分支)

视频大小 结果
3.5GB 整个电脑 crush 崩溃了
image
1.3GB 在视频解析阶段进程会被卡死,等待一段时间之后能正常播放视频
image
87.7MB 功能正常使用

after(本 PR 代码)

视频大小 结果
3.5GB 解析进度比较慢,但是能浏览器和操作系统不会被卡死
image
等待很久之后,视频能够播放出来,但是画面比较卡顿
image
1.3GB 功能正常使用
87.7MB 功能正常使用

## 内存泄露(这部分的内容其实与本 PR 无关,先纪录下来问题,未来会在其他 PR 修复)

在测试的过程中,有监听浏览器内存占用情况。发现会有内存泄露的问题:

  • 初始页面: image
  • 视频播放:image
  • 视频播放一段时间:image
  • 视频播放完毕:image

performance 抓取数据

image

内存快照

image

注释掉 audioFrameFinder 代码内存占用立马降低 10+ 倍

image

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.

None yet

1 participant