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

fix: 完善nodeIdentifier的生成判断以解决崩溃问题 #82

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

LinXunFeng
Copy link
Contributor

在使用 m3u8 进行播放时遇到崩溃

image

通过调用栈定位到,因生成错误的 nodeIdentifier 而无法从 mSegmentItems 中取到值,致 itemnil

image
nodeIdentifier	__NSCFString *	@"0b62aeb8344fdc978b56ef6ba80ef9f6.ts_0_9223372036854775807"	0x0000000302cbdc70
static const NSInteger NSNotFound = NSIntegerMax;

根据 NSNotFound 的定义得知,其实际上是 NSInteger 的最大值:

  • 32 位系统上是 2147483647 (0x7fffffff)
  • 64 位系统上是 9223372036854775807 (0x7fffffffffffffff)

所以 nodeIdentifier 中的 9223372036854775807NSNotFound,即此时的 byteRange.lengthNSNotFound

image image

上方两个截图的情况:

  1. byteRange.locationNSNotFound,一切正常
  2. 但是有时会出现 byteRange.location0,而 byteRange.lengthNSNotFound 的情况,此时就会得到错误的 nodeIdentifier

综上,本 PRgenerateSegmentNodeIdentifierWithIdentifier 进行完善,补充 byteRange.length == NSNotFound 的判断,以此来解决崩溃问题。

@changsanjiang changsanjiang merged commit 11d0d34 into changsanjiang:master Feb 13, 2025
@changsanjiang
Copy link
Owner

晚点发布, 我先测测

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