pili-engineering / PLCameraStreamingKit

PLCameraStreamingKit 是 Pili 直播 SDK 的 iOS 推流端,是带有采集模块老版本 SDK。如果是新用户接入,建议使用 PLMediaStreamingKit。该版本支持 RTMP 推流,h.264 和 AAC 编码,硬编软编支持。具有丰富的数据和状态回调,方便用户根据自己的业务定制化开发。具有直播场景下的重要功能,如:美颜、背景音乐、水印等功能。
https://github.com/pili-engineering/PLMediaStreamingKit
Apache License 2.0
1.03k stars 254 forks source link

变更推流质量一两分钟内必定crash #46

Closed 5kccp closed 8 years ago

5kccp commented 9 years ago

crash时控制台输出

2015-10-22 10:32:40.307 AGVideoDev[1572:146482] Items dropped, buffer duration: 3.44
2015-10-22 10:32:40.309 AGVideoDev[1572:146482] Items dropped, buffer duration: 3.44
2015-10-22 10:32:40.374 AGVideoDev[1572:146482] Items dropped, buffer duration: 3.46
2015-10-22 10:32:40.378 AGVideoDev[1572:146482] Items dropped, buffer duration: 3.46
2015-10-22 10:32:40.438 AGVideoDev[1572:146482] Items dropped, buffer duration: 3.53
2015-10-22 10:32:40.442 AGVideoDev[1572:146482] Items dropped, buffer duration: 3.53
ERROR: WriteN, RTMP send error 32, Broken pipe, (129 bytes)
ERROR: WriteN, RTMP send error 32, Broken pipe, (110 bytes)
ERROR: WriteN, RTMP send error 32, Broken pipe, (42 bytes)

一般变更几次videoQuality就会crash。我初始化的kPLVideoStreamingQualityHigh1。然后变更如下:

- (void)streamingSessionSendingBufferFillDidLowerThanLowThreshold:(id)session{
    if ([self.session.videoConfiguration.videoQuality isEqualToString:kPLVideoStreamingQualityHigh1]) {
        [self.session beginUpdateConfiguration];
        self.session.videoConfiguration.videoQuality = kPLVideoStreamingQualityHigh2;
        [self.session endUpdateConfiguration];
    }
    else if ([self.session.videoConfiguration.videoQuality isEqualToString:kPLVideoStreamingQualityHigh2]) {
        [self.session beginUpdateConfiguration];
        self.session.videoConfiguration.videoQuality = kPLVideoStreamingQualityHigh3;
        [self.session endUpdateConfiguration];
    }
    DDLogVerbose(@"%@", self.session.videoConfiguration.videoQuality);
}
- (void)streamingSessionSendingBufferFillDidHigherThanHighThreshold:(id)session{
    if ([self.session.videoConfiguration.videoQuality isEqualToString:kPLVideoStreamingQualityHigh3]) {
        [self.session beginUpdateConfiguration];
        self.session.videoConfiguration.videoQuality = kPLVideoStreamingQualityHigh2;
        [self.session endUpdateConfiguration];
    }
    else if ([self.session.videoConfiguration.videoQuality isEqualToString:kPLVideoStreamingQualityHigh2]) {
        [self.session beginUpdateConfiguration];
        self.session.videoConfiguration.videoQuality = kPLVideoStreamingQualityHigh1;
        [self.session endUpdateConfiguration];
    }
    DDLogVerbose(@"%@", self.session.videoConfiguration.videoQuality);
}

函数栈如下:

* thread #1: tid = 0x23a26, 0x0000000193c90e0c libsystem_kernel.dylib`mach_msg_trap + 8, queue = 'com.apple.main-thread', stop reason = signal SIGPIPE
    frame #0: 0x0000000193c90e0c libsystem_kernel.dylib`mach_msg_trap + 8
    frame #1: 0x0000000193c90c88 libsystem_kernel.dylib`mach_msg + 72
    frame #2: 0x0000000182053724 CoreFoundation`__CFRunLoopServiceMachPort + 200
    frame #3: 0x0000000182051678 CoreFoundation`__CFRunLoopRun + 940
    frame #4: 0x0000000181f7d2d4 CoreFoundation`CFRunLoopRunSpecific + 396
    frame #5: 0x000000018b87b6fc GraphicsServices`GSEventRunModal + 168
    frame #6: 0x0000000186b7af40 UIKit`UIApplicationMain + 1488
  * frame #7: 0x000000010017e610 AGVideoDev`main(argc=1, argv=0x000000016fdc3998) + 124 at main.m:14
    frame #8: 0x0000000193b92a08 libdyld.dylib`start + 4

我的系统是iOS8.4,SDK版本是1.4.4

Phunk87 commented 8 years ago

Fixed