Commit 0caff89556fb0c334b51255738af2a87818e39ec
1 parent
dcb08329
提交0.1.15
Showing
2 changed files
with
7 additions
and
4 deletions
CNLiveUploadManager.podspec
CNLiveUploadManager/Classes/CNLiveUploadManager.m
| ... | ... | @@ -2291,12 +2291,11 @@ static CNLiveUploadManager *_uploadManager; |
| 2291 | 2291 | shortVideoTranscoder.videoFrameRate = 0; //帧率 |
| 2292 | 2292 | |
| 2293 | 2293 | |
| 2294 | - | |
| 2294 | + dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); | |
| 2295 | 2295 | [PLShortVideoRecorder checkAuthentication:^(PLSAuthenticationResult result) { |
| 2296 | 2296 | |
| 2297 | 2297 | if (PLSAuthenticationResultAuthorized == result) {//授权 |
| 2298 | 2298 | |
| 2299 | - dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); | |
| 2300 | 2299 | //成功 |
| 2301 | 2300 | [shortVideoTranscoder setCompletionBlock:^(NSURL *url){ |
| 2302 | 2301 | NSLog(@"输出转码后视频路径%@",url.path); |
| ... | ... | @@ -2319,18 +2318,22 @@ static CNLiveUploadManager *_uploadManager; |
| 2319 | 2318 | |
| 2320 | 2319 | NSLog(@"transCoding progress: %f", progress); |
| 2321 | 2320 | !progressCount ? : progressCount(progress); |
| 2321 | + | |
| 2322 | 2322 | }]; |
| 2323 | 2323 | |
| 2324 | 2324 | [shortVideoTranscoder startTranscoding]; |
| 2325 | - dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER); | |
| 2325 | + | |
| 2326 | 2326 | }else{//未授权 |
| 2327 | 2327 | |
| 2328 | 2328 | !failure ? : failure(); |
| 2329 | + dispatch_semaphore_signal(semaphore); | |
| 2329 | 2330 | } |
| 2330 | 2331 | |
| 2331 | 2332 | |
| 2332 | 2333 | }]; |
| 2333 | 2334 | |
| 2335 | + dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER); | |
| 2336 | + | |
| 2334 | 2337 | |
| 2335 | 2338 | |
| 2336 | 2339 | } | ... | ... |