implement clearSessions methods on FFmpegKitConfig

This commit is contained in:
Taner Sener 2021-09-15 16:46:17 +01:00
parent caa53bedd8
commit 64d380290a
3 changed files with 24 additions and 0 deletions

View File

@ -1020,6 +1020,16 @@ public class FFmpegKitConfig {
}
}
/**
* <p>Clears all, including ongoing, sessions in the session history.
* <p>Note that callbacks cannot be triggered for deleted sessions.
*/
public static void clearSessions() {
synchronized (sessionHistoryLock) {
sessionHistoryList.clear();
}
}
/**
* <p>Returns all FFmpeg sessions in the session history.
*

View File

@ -329,6 +329,12 @@ typedef NS_ENUM(NSUInteger, Signal) {
*/
+ (NSArray*)getSessions;
/**
* <p>Clears all, including ongoing, sessions in the session history.
* <p>Note that callbacks cannot be triggered for deleted sessions.
*/
+ (void)clearSessions;
/**
* <p>Returns all FFmpeg sessions in the session history.
*

View File

@ -1072,6 +1072,14 @@ int executeFFprobe(long sessionId, NSArray* arguments) {
return sessionsCopy;
}
+ (void)clearSessions {
[sessionHistoryLock lock];
[sessionHistoryList removeAllObjects];
[sessionHistoryLock unlock];
}
+ (NSArray*)getFFmpegSessions {
NSMutableArray* ffmpegSessions = [[NSMutableArray alloc] init];