feat: add clearSession method for apple

pull/1067/head
Hakim 7 months ago
parent ea8e8ded96
commit d80b767768
  1. 8
      apple/src/FFmpegKitConfig.h
  2. 11
      apple/src/FFmpegKitConfig.m

@ -375,6 +375,14 @@ typedef NS_ENUM(NSUInteger, Signal) {
*/
+ (NSArray*)getSessions;
/**
* <p>Clears the session specified with <code>sessionId</code> from the session history.
* <p>Note that callbacks cannot be triggered for deleted sessions.
*
* @param sessionId session identifier
*/
+ (void)clearSession:(long)sessionId;
/**
* <p>Clears all, including ongoing, sessions in the session history.
* <p>Note that callbacks cannot be triggered for deleted sessions.

@ -1237,6 +1237,17 @@ int executeFFprobe(long sessionId, NSArray* arguments) {
return sessionsCopy;
}
+ (void)clearSession:(long)sessionId {
[sessionHistoryLock lock];
id<Session> session = [self getSession:sessionId];
if (session != nil) {
[sessionHistoryList removeObject:session];
[sessionHistoryMap removeObjectForKey:[NSNumber numberWithLong:sessionId]];
}
[sessionHistoryLock unlock];
}
+ (void)clearSessions {
[sessionHistoryLock lock];

Loading…
Cancel
Save