QGMP4FrameHWDecoder.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. // QGMP4FrameHWDecoder.m
  2. // Tencent is pleased to support the open source community by making vap available.
  3. //
  4. // Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
  5. //
  6. // Licensed under the MIT License (the "License"); you may not use this file except in
  7. // compliance with the License. You may obtain a copy of the License at
  8. //
  9. // http://opensource.org/licenses/MIT
  10. //
  11. // Unless required by applicable law or agreed to in writing, software distributed under the License is
  12. // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
  13. // either express or implied. See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. #import "QGMP4FrameHWDecoder.h"
  16. #import "QGVAPWeakProxy.h"
  17. #import "QGMP4AnimatedImageFrame.h"
  18. #import "QGBaseAnimatedImageFrame+Displaying.h"
  19. #import <VideoToolbox/VideoToolbox.h>
  20. #import "QGHWDMP4OpenGLView.h"
  21. #import "QGMP4Parser.h"
  22. #import "QGVAPSafeMutableArray.h"
  23. #import "NSNotificationCenter+VAPThreadSafe.h"
  24. #include <sys/sysctl.h>
  25. #import <AVFoundation/AVFoundation.h>
  26. @implementation UIDevice (HWD)
  27. - (BOOL)hwd_isSimulator {
  28. static dispatch_once_t token;
  29. static BOOL isSimulator = NO;
  30. dispatch_once(&token, ^{
  31. NSString *model = [self machineName];
  32. if ([model isEqualToString:@"x86_64"] || [model isEqualToString:@"i386"]) {
  33. isSimulator = YES;
  34. }
  35. });
  36. return isSimulator;
  37. }
  38. - (NSString *)machineName {
  39. static dispatch_once_t token;
  40. static NSString *name;
  41. dispatch_once(&token, ^{
  42. size_t size;
  43. sysctlbyname("hw.machine", NULL, &size, NULL, 0);
  44. char *machineName = malloc(size);
  45. sysctlbyname("hw.machine", machineName, &size, NULL, 0);
  46. name = [NSString stringWithUTF8String:machineName];
  47. free(machineName);
  48. });
  49. return name;
  50. }
  51. @end
  52. @interface NSArray (SafeOperation)
  53. @end
  54. @implementation NSArray (SafeOperation)
  55. - (id)safeObjectAtIndex:(NSUInteger)index
  56. {
  57. if (index >= self.count) {
  58. NSAssert(0, @"Error: access to array index which is beyond bounds! ");
  59. return nil;
  60. }
  61. return self[index];
  62. }
  63. @end
  64. @interface QGMP4FrameHWDecoder() {
  65. NSMutableArray *_buffers;
  66. int _videoStream;
  67. int _outputWidth, _outputHeight;
  68. OSStatus _status;
  69. BOOL _isFinish;
  70. VTDecompressionSessionRef _mDecodeSession;
  71. CMFormatDescriptionRef _mFormatDescription;
  72. NSInteger _finishFrameIndex;
  73. NSError *_constructErr;
  74. QGMP4ParserProxy *_mp4Parser;
  75. int _invalidRetryCount;
  76. }
  77. @property (atomic, strong) dispatch_queue_t decodeQueue; //dispatch decode task
  78. @property (nonatomic, strong) NSData *ppsData; //Picture Parameter Set
  79. @property (nonatomic, strong) NSData *spsData; //Sequence Parameter Set
  80. /** Video Parameter Set */
  81. @property (nonatomic, strong) NSData *vpsData;
  82. @property (atomic, assign) NSInteger lastDecodeFrame;
  83. @end
  84. NSString *const QGMP4HWDErrorDomain = @"QGMP4HWDErrorDomain";
  85. @implementation QGMP4FrameHWDecoder
  86. + (NSString *)errorDescriptionForCode:(QGMP4HWDErrorCode)errorCode {
  87. NSArray *errorDescs = @[@"文件不存在",@"非法文件格式",@"无法获取视频流信息",@"无法获取视频流",@"VTB创建desc失败",@"VTB创建session失败"];
  88. NSString *desc = @"";
  89. switch (errorCode) {
  90. case QGMP4HWDErrorCode_FileNotExist:
  91. desc = [errorDescs safeObjectAtIndex:0];
  92. break;
  93. case QGMP4HWDErrorCode_InvalidMP4File:
  94. desc = [errorDescs safeObjectAtIndex:1];
  95. break;
  96. case QGMP4HWDErrorCode_CanNotGetStreamInfo:
  97. desc = [errorDescs safeObjectAtIndex:2];
  98. break;
  99. case QGMP4HWDErrorCode_CanNotGetStream:
  100. desc = [errorDescs safeObjectAtIndex:3];
  101. break;
  102. case QGMP4HWDErrorCode_ErrorCreateVTBDesc:
  103. desc = [errorDescs safeObjectAtIndex:4];
  104. break;
  105. case QGMP4HWDErrorCode_ErrorCreateVTBSession:
  106. desc = [errorDescs safeObjectAtIndex:5];
  107. break;
  108. default:
  109. break;
  110. }
  111. return desc;
  112. }
  113. - (instancetype)initWith:(QGMP4HWDFileInfo *)fileInfo error:(NSError *__autoreleasing *)error{
  114. if (self = [super initWith:fileInfo error:error]) {
  115. _decodeQueue = dispatch_queue_create("com.qgame.vap.decode", DISPATCH_QUEUE_SERIAL);
  116. _lastDecodeFrame = -1;
  117. _mp4Parser = fileInfo.mp4Parser;
  118. BOOL isOpenSuccess = [self onInputStart];
  119. if (!isOpenSuccess) {
  120. VAP_Event(kQGVAPModuleCommon, @"onInputStart fail!");
  121. *error = _constructErr;
  122. self = nil;
  123. return nil;
  124. }
  125. [self registerNotification];
  126. }
  127. return self;
  128. }
  129. - (void)registerNotification {
  130. }
  131. - (void)hwd_didReceiveEnterBackgroundNotification:(NSNotification *)notification {
  132. }
  133. - (void)decodeFrame:(NSInteger)frameIndex buffers:(NSMutableArray *)buffers {
  134. if (frameIndex == self.currentDecodeFrame) {
  135. VAP_Event(kQGVAPModuleCommon, @"already in decode");
  136. return ;
  137. }
  138. self.currentDecodeFrame = frameIndex;
  139. _buffers = buffers;
  140. dispatch_async(self.decodeQueue, ^{
  141. if (frameIndex != self.lastDecodeFrame + 1) {
  142. // 必须是依次增大,否则解出来的画面会异常
  143. return;
  144. }
  145. [self _decodeFrame:frameIndex drop:NO];
  146. });
  147. }
  148. - (void)_decodeFrame:(NSInteger)frameIndex drop:(BOOL)dropFlag {
  149. if (_isFinish) {
  150. return ;
  151. }
  152. if (!_buffers) {
  153. return ;
  154. }
  155. if (self.spsData == nil || self.ppsData == nil) {
  156. return ;
  157. }
  158. //解码开始时间
  159. NSDate *startDate = [NSDate date];
  160. NSData *packetData = [_mp4Parser readPacketOfSample:frameIndex];
  161. if (!packetData.length) {
  162. _finishFrameIndex = frameIndex;
  163. [self _onInputEnd];
  164. return;
  165. }
  166. // 获取当前帧pts,pts是在parse mp4 box时得到的
  167. uint64_t currentPts = [_mp4Parser.videoSamples[frameIndex] pts];
  168. CVPixelBufferRef outputPixelBuffer = NULL;
  169. // 4. get NALUnit payload into a CMBlockBuffer,
  170. CMBlockBufferRef blockBuffer = NULL;
  171. _status = CMBlockBufferCreateWithMemoryBlock(kCFAllocatorDefault,
  172. (void *)packetData.bytes,
  173. packetData.length,
  174. kCFAllocatorNull, NULL, 0,
  175. packetData.length, 0,
  176. &blockBuffer);
  177. // 6. create a CMSampleBuffer.
  178. CMSampleBufferRef sampleBuffer = NULL;
  179. const size_t sampleSizeArray[] = {packetData.length};
  180. _status = CMSampleBufferCreateReady(kCFAllocatorDefault,
  181. blockBuffer,
  182. _mFormatDescription,
  183. 1, 0, NULL, 1, sampleSizeArray,
  184. &sampleBuffer);
  185. if (blockBuffer) {
  186. CFRelease(blockBuffer);
  187. }
  188. // 7. use VTDecompressionSessionDecodeFrame
  189. if (@available(iOS 9.0, *)) {
  190. __typeof(self) __weak weakSelf = self;
  191. VTDecodeFrameFlags flags = 0;
  192. VTDecodeInfoFlags flagOut = 0;
  193. OSStatus status = VTDecompressionSessionDecodeFrameWithOutputHandler(_mDecodeSession, sampleBuffer, flags, &flagOut, ^(OSStatus status, VTDecodeInfoFlags infoFlags, CVImageBufferRef _Nullable imageBuffer, CMTime presentationTimeStamp, CMTime presentationDuration) {
  194. __typeof(self) strongSelf = weakSelf;
  195. if (strongSelf == nil) {
  196. return;
  197. }
  198. [strongSelf handleDecodePixelBuffer:imageBuffer
  199. sampleBuffer:sampleBuffer
  200. frameIndex:frameIndex
  201. currentPts:currentPts
  202. startDate:startDate
  203. status:status
  204. needDrop:dropFlag];
  205. });
  206. if (status == kVTInvalidSessionErr) {
  207. CFRelease(sampleBuffer);
  208. // 防止陷入死循环
  209. if (_invalidRetryCount >= 3) {
  210. return;
  211. }
  212. [self resetDecoder];
  213. // 从最近I帧一直解码到当前帧,中间帧丢弃
  214. [self findKeyFrameAndDecodeToCurrent:frameIndex];
  215. } else {
  216. _invalidRetryCount = 0;
  217. }
  218. } else {
  219. // 7. use VTDecompressionSessionDecodeFrame
  220. VTDecodeFrameFlags flags = 0;
  221. VTDecodeInfoFlags flagOut = 0;
  222. _status = VTDecompressionSessionDecodeFrame(_mDecodeSession, sampleBuffer, flags, &outputPixelBuffer, &flagOut);
  223. if (_status == kVTInvalidSessionErr) {
  224. CFRelease(sampleBuffer);
  225. // 防止陷入死循环
  226. if (_invalidRetryCount >= 3) {
  227. return;
  228. }
  229. [self resetDecoder];
  230. // 从最近I帧一直解码到当前帧,中间帧丢弃
  231. [self findKeyFrameAndDecodeToCurrent:frameIndex];
  232. return;
  233. } else {
  234. _invalidRetryCount = 0;
  235. }
  236. [self handleDecodePixelBuffer:outputPixelBuffer
  237. sampleBuffer:sampleBuffer
  238. frameIndex:frameIndex
  239. currentPts:currentPts
  240. startDate:startDate
  241. status:_status
  242. needDrop:dropFlag];
  243. }
  244. }
  245. - (void)handleDecodePixelBuffer:(CVPixelBufferRef)pixelBuffer
  246. sampleBuffer:(CMSampleBufferRef)sampleBuffer
  247. frameIndex:(NSInteger)frameIndex
  248. currentPts:(uint64_t)currentPts
  249. startDate:(NSDate *)startDate
  250. status:(OSStatus)status
  251. needDrop:(BOOL)dropFlag {
  252. self.lastDecodeFrame = frameIndex;
  253. CFRelease(sampleBuffer);
  254. if(status == kVTInvalidSessionErr) {
  255. VAP_Error(kQGVAPModuleCommon, @"decompress fail! frame:%@ kVTInvalidSessionErr error:%@", @(frameIndex), @(status));
  256. } else if(status == kVTVideoDecoderBadDataErr) {
  257. VAP_Error(kQGVAPModuleCommon, @"decompress fail! frame:%@ kVTVideoDecoderBadDataErr error:%@", @(frameIndex), @(status));
  258. } else if(status != noErr) {
  259. VAP_Error(kQGVAPModuleCommon, @"decompress fail! frame:%@ error:%@", @(frameIndex), @(status));
  260. }
  261. if (dropFlag) {
  262. return;
  263. }
  264. QGMP4AnimatedImageFrame *newFrame = [[QGMP4AnimatedImageFrame alloc] init];
  265. // imagebuffer会在frame回收时释放
  266. CVPixelBufferRetain(pixelBuffer);
  267. newFrame.pixelBuffer = pixelBuffer;
  268. newFrame.frameIndex = frameIndex; //dts顺序
  269. NSTimeInterval decodeTime = [[NSDate date] timeIntervalSinceDate:startDate]*1000;
  270. newFrame.decodeTime = decodeTime;
  271. newFrame.defaultFps = (int)_mp4Parser.fps;
  272. newFrame.pts = currentPts;
  273. // 8. insert into buffer
  274. [_buffers addObject:newFrame];
  275. // 9. sort
  276. [_buffers sortUsingComparator:^NSComparisonResult(QGMP4AnimatedImageFrame * _Nonnull obj1, QGMP4AnimatedImageFrame * _Nonnull obj2) {
  277. return [@(obj1.pts) compare:@(obj2.pts)];
  278. }];
  279. }
  280. #pragma mark - override
  281. - (BOOL)shouldStopDecode:(NSInteger)nextFrameIndex {
  282. return _isFinish;
  283. }
  284. - (BOOL)isFrameIndexBeyondEnd:(NSInteger)frameIndex {
  285. if (_finishFrameIndex > 0) {
  286. return (frameIndex >= _finishFrameIndex);
  287. }
  288. return NO;
  289. }
  290. -(void)dealloc {
  291. [[NSNotificationCenter defaultCenter] removeObserver:self];
  292. [self _onInputEnd];
  293. self.fileInfo.occupiedCount --;
  294. if (self.fileInfo.occupiedCount <= 0) {
  295. }
  296. }
  297. #pragma mark - private methods
  298. - (BOOL)onInputStart {
  299. NSFileManager *fileMgr = [NSFileManager defaultManager];
  300. if (![fileMgr fileExistsAtPath:self.fileInfo.filePath]) {
  301. _constructErr = [NSError errorWithDomain:QGMP4HWDErrorDomain code:QGMP4HWDErrorCode_FileNotExist userInfo:[self errorUserInfo]];
  302. return NO;
  303. }
  304. _isFinish = NO;
  305. self.vpsData = nil;
  306. self.spsData = nil;
  307. self.ppsData = nil;
  308. _outputWidth = (int)_mp4Parser.picWidth;
  309. _outputHeight = (int)_mp4Parser.picHeight;
  310. BOOL paramsSetInitSuccess = [self initPPSnSPS];
  311. return paramsSetInitSuccess;
  312. }
  313. - (BOOL)initPPSnSPS {
  314. VAP_Info(kQGVAPModuleCommon, @"initPPSnSPS");
  315. if (self.spsData && self.ppsData) {
  316. VAP_Error(kQGVAPModuleCommon, @"sps&pps is already has value.");
  317. return YES;
  318. }
  319. self.spsData = _mp4Parser.spsData;
  320. self.ppsData = _mp4Parser.ppsData;
  321. self.vpsData = _mp4Parser.vpsData;
  322. // 2. create CMFormatDescription
  323. if (self.spsData != nil && self.ppsData != nil && _mp4Parser.videoCodecID != QGMP4VideoStreamCodecIDUnknown) {
  324. if (_mp4Parser.videoCodecID == QGMP4VideoStreamCodecIDH264) {
  325. const uint8_t* const parameterSetPointers[2] = { (const uint8_t*)[self.spsData bytes], (const uint8_t*)[self.ppsData bytes] };
  326. const size_t parameterSetSizes[2] = { [self.spsData length], [self.ppsData length] };
  327. _status = CMVideoFormatDescriptionCreateFromH264ParameterSets(kCFAllocatorDefault,
  328. 2,
  329. parameterSetPointers,
  330. parameterSetSizes,
  331. 4,
  332. &_mFormatDescription);
  333. if (_status != noErr) {
  334. VAP_Event(kQGVAPModuleCommon, @"CMVideoFormatDescription. Creation: %@.", (_status == noErr) ? @"successfully." : @"failed.");
  335. _constructErr = [NSError errorWithDomain:QGMP4HWDErrorDomain code:QGMP4HWDErrorCode_ErrorCreateVTBDesc userInfo:[self errorUserInfo]];
  336. return NO;
  337. }
  338. } else if (_mp4Parser.videoCodecID == QGMP4VideoStreamCodecIDH265) {
  339. if (@available(iOS 11.0, *)) {
  340. if(VTIsHardwareDecodeSupported(kCMVideoCodecType_HEVC)) {
  341. const uint8_t* const parameterSetPointers[3] = {(const uint8_t*)[self.vpsData bytes], (const uint8_t*)[self.spsData bytes], (const uint8_t*)[self.ppsData bytes]};
  342. const size_t parameterSetSizes[3] = {[self.vpsData length], [self.spsData length], [self.ppsData length]};
  343. _status = CMVideoFormatDescriptionCreateFromHEVCParameterSets(kCFAllocatorDefault,
  344. 3, // parameter_set_count
  345. parameterSetPointers, // &parameter_set_pointers
  346. parameterSetSizes, // &parameter_set_sizes
  347. 4, // nal_unit_header_length
  348. NULL,
  349. &_mFormatDescription);
  350. if (_status != noErr) {
  351. VAP_Event(kQGVAPModuleCommon, @"CMVideoFormatDescription. Creation: %@.", (_status == noErr) ? @"successfully." : @"failed.");
  352. _constructErr = [NSError errorWithDomain:QGMP4HWDErrorDomain code:QGMP4HWDErrorCode_ErrorCreateVTBDesc userInfo:[self errorUserInfo]];
  353. return NO;
  354. }
  355. } else {
  356. VAP_Event(kQGVAPModuleCommon, @"H.265 decoding is un-supported because of the hardware");
  357. return NO;
  358. }
  359. } else {
  360. VAP_Event(kQGVAPModuleCommon, @"System version is too low to support H.265 decoding");
  361. return NO;
  362. }
  363. }
  364. }
  365. // 3. create VTDecompressionSession
  366. return [self createDecompressionSession];;
  367. }
  368. - (BOOL)createDecompressionSession {
  369. CFDictionaryRef attrs = NULL;
  370. const void *keys[] = {kCVPixelBufferPixelFormatTypeKey};
  371. // kCVPixelFormatType_420YpCbCr8Planar is YUV420
  372. // kCVPixelFormatType_420YpCbCr8BiPlanarFullRange is NV12
  373. uint32_t v = kCVPixelFormatType_420YpCbCr8BiPlanarFullRange;
  374. const void *values[] = { CFNumberCreate(NULL, kCFNumberSInt32Type, &v) };
  375. attrs = CFDictionaryCreate(NULL, keys, values, 1, NULL, NULL);
  376. if ([UIDevice currentDevice].systemVersion.floatValue >= 9.0) {
  377. _status = VTDecompressionSessionCreate(kCFAllocatorDefault,
  378. _mFormatDescription,
  379. NULL,
  380. attrs,
  381. NULL,
  382. &_mDecodeSession);
  383. if (_status != noErr) {
  384. CFRelease(attrs);
  385. _constructErr = [NSError errorWithDomain:QGMP4HWDErrorDomain code:QGMP4HWDErrorCode_ErrorCreateVTBSession userInfo:[self errorUserInfo]];
  386. return NO;
  387. }
  388. } else {
  389. VTDecompressionOutputCallbackRecord callBackRecord;
  390. callBackRecord.decompressionOutputCallback = didDecompress;
  391. callBackRecord.decompressionOutputRefCon = NULL;
  392. _status = VTDecompressionSessionCreate(kCFAllocatorDefault,
  393. _mFormatDescription,
  394. NULL, attrs,
  395. &callBackRecord,
  396. &_mDecodeSession);
  397. if (_status != noErr) {
  398. CFRelease(attrs);
  399. _constructErr = [NSError errorWithDomain:QGMP4HWDErrorDomain code:QGMP4HWDErrorCode_ErrorCreateVTBSession userInfo:[self errorUserInfo]];
  400. return NO;
  401. }
  402. }
  403. CFRelease(attrs);
  404. return YES;
  405. }
  406. - (void)resetDecoder {
  407. // delete
  408. if (_mDecodeSession) {
  409. VTDecompressionSessionWaitForAsynchronousFrames(_mDecodeSession);
  410. VTDecompressionSessionInvalidate(_mDecodeSession);
  411. CFRelease(_mDecodeSession);
  412. _mDecodeSession = NULL;
  413. }
  414. // recreate
  415. [self createDecompressionSession];
  416. }
  417. - (void)findKeyFrameAndDecodeToCurrent:(NSInteger)frameIndex {
  418. [[NSNotificationCenter defaultCenter] postNotificationName:kQGVAPDecoderSeekStart object:self];
  419. NSArray<NSNumber *> *keyframeIndexes = [_mp4Parser videoSyncSampleIndexes];
  420. NSInteger index = [[keyframeIndexes firstObject] integerValue];
  421. for(NSNumber *number in keyframeIndexes) {
  422. if(number.integerValue < frameIndex) {
  423. index = number.integerValue;
  424. continue;
  425. } else {
  426. break;
  427. }
  428. }
  429. // seek to last key frame
  430. while (index < frameIndex) {
  431. [self _decodeFrame:index drop:YES];
  432. index++;
  433. }
  434. [self _decodeFrame:frameIndex drop:NO];
  435. [[NSNotificationCenter defaultCenter] postNotificationName:kQGVAPDecoderSeekFinish object:self];
  436. }
  437. - (void)_onInputEnd {
  438. if (_isFinish) {
  439. return ;
  440. }
  441. _isFinish = YES;
  442. if (_mDecodeSession) {
  443. VTDecompressionSessionWaitForAsynchronousFrames(_mDecodeSession);
  444. VTDecompressionSessionInvalidate(_mDecodeSession);
  445. CFRelease(_mDecodeSession);
  446. _mDecodeSession = NULL;
  447. }
  448. if (self.spsData || self.ppsData || self.vpsData) {
  449. self.spsData = nil;
  450. self.ppsData = nil;
  451. self.vpsData = nil;
  452. }
  453. if (_mFormatDescription) {
  454. CFRelease(_mFormatDescription);
  455. _mFormatDescription = NULL;
  456. }
  457. }
  458. - (void)onInputEnd {
  459. //为确保任务停止,必须同步执行
  460. __weak __typeof(self) weakSelf = self;
  461. if ([NSThread isMainThread]) {
  462. dispatch_sync(self.decodeQueue, ^{
  463. [weakSelf _onInputEnd];
  464. });
  465. } else {
  466. dispatch_async(self.decodeQueue, ^{
  467. [weakSelf _onInputEnd];
  468. });
  469. }
  470. }
  471. //decode callback
  472. static void didDecompress(void *decompressionOutputRefCon, void *sourceFrameRefCon, OSStatus status, VTDecodeInfoFlags infoFlags, CVImageBufferRef pixelBuffer, CMTime presentationTimeStamp, CMTime presentationDuration ){
  473. CVPixelBufferRef *outputPixelBuffer = (CVPixelBufferRef *)sourceFrameRefCon;
  474. *outputPixelBuffer = CVPixelBufferRetain(pixelBuffer);
  475. }
  476. - (NSDictionary *)errorUserInfo {
  477. NSDictionary *userInfo = @{@"location" : self.fileInfo.filePath ? : @""};
  478. return userInfo;
  479. }
  480. @end