Skip to content

Commit

Permalink
don't check filter update in audio or video thread
Browse files Browse the repository at this point in the history
  • Loading branch information
exeldro committed Mar 11, 2022
1 parent 2af7f09 commit 319f080
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 9 deletions.
24 changes: 21 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
run: |
curl -L -O http://s.sudre.free.fr/Software/files/Packages.dmg
sudo hdiutil attach ./Packages.dmg
sudo installer -pkg /Volumes/Packages\ 1.2.9/Install\ Packages.pkg -target /
sudo installer -pkg /Volumes/Packages\ 1.2.10/Install\ Packages.pkg -target /
- name: Package
if: success()
shell: bash
Expand Down Expand Up @@ -197,7 +197,7 @@ jobs:
runs-on: [windows-latest]
env:
QT_VERSION: '5.15.2'
CMAKE_GENERATOR: "Visual Studio 16 2019"
CMAKE_GENERATOR: "Visual Studio 17 2022"
CMAKE_SYSTEM_VERSION: "10.0.18363.657"
WINDOWS_DEPS_VERSION: '2019'
steps:
Expand Down Expand Up @@ -268,6 +268,20 @@ jobs:
robocopy .\build64\rundir\RelWithDebInfo\obs-plugins\64bit\ .\package\obs-plugins\64bit ${{ env.PLUGIN_NAME }}.* /E /XF .gitignore
robocopy .\build64\rundir\RelWithDebInfo\data\obs-plugins\${{ env.PLUGIN_NAME }}\ .\package\data\obs-plugins\${{ env.PLUGIN_NAME }}\ /E /XF .gitignore
exit 0
- name: Create Code Signing Certificate
if: success() && github.event_name != 'pull_request'
run: |
New-Item -ItemType directory -Path certificate
Set-Content -Path certificate\certificate.txt -Value '${{ secrets.CERTIFICATE }}'
certutil -decode certificate\certificate.txt certificate\certificate.pfx
- name: Code Sign 32
if: success() && github.event_name != 'pull_request'
run: |
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.20348.0/x86/signtool.exe' sign /fd SHA256 /f certificate\certificate.pfx /p '${{ secrets.CERTIFICATE_PASS }}' /t http://timestamp.comodoca.com/authenticode .\package\obs-plugins\32bit\${{ env.PLUGIN_NAME }}.dll
- name: Code Sign 64
if: success() && github.event_name != 'pull_request'
run: |
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.20348.0/x64/signtool.exe' sign /fd SHA256 /f certificate\certificate.pfx /p '${{ secrets.CERTIFICATE_PASS }}' /t http://timestamp.comodoca.com/authenticode .\package\obs-plugins\64bit\${{ env.PLUGIN_NAME }}.dll
- name: Publish zip
if: success()
uses: actions/upload-artifact@v2.2.0
Expand All @@ -282,9 +296,13 @@ jobs:
- name: "Package Installer (Compile)"
run: |
& 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' /Qp ".\build64\plugins\${{ env.PLUGIN_NAME }}\installer.iss"
- name: Code Sign Installer
if: success() && github.event_name != 'pull_request'
run: |
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.20348.0/x64/signtool.exe' sign /fd SHA256 /f certificate\certificate.pfx /p '${{ secrets.CERTIFICATE_PASS }}' /t http://timestamp.comodoca.com/authenticode .\package\${{ env.PLUGIN_NAME }}-installer.exe
- name: Publish installer
if: success()
uses: actions/upload-artifact@v2.2.0
with:
name: '${{ env.FILE_NAME }}-installer'
path: package/*.exe
path: package/*.exe
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project(replay-source VERSION 1.6.9)
project(replay-source VERSION 1.6.10)
set(PROJECT_FULL_NAME "Replay Source")

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_SOURCE_DIR}/version.h)
Expand Down
6 changes: 5 additions & 1 deletion replay-filter-async.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ replay_filter_video(void *data, struct obs_source_frame *frame)
}
}
pthread_mutex_unlock(&filter->mutex);
replay_filter_check(filter);
return frame;
}

Expand All @@ -198,6 +197,10 @@ static obs_properties_t *replay_filter_properties(void *unused)
return props;
}

static void replay_filter_tick(void *data, float seconds){
replay_filter_check(data);
}

struct obs_source_info replay_filter_async_info = {
.id = REPLAY_FILTER_ASYNC_ID,
.type = OBS_SOURCE_TYPE_FILTER,
Expand All @@ -206,6 +209,7 @@ struct obs_source_info replay_filter_async_info = {
.destroy = replay_filter_destroy,
.update = replay_filter_update,
.load = replay_filter_update,
.video_tick = replay_filter_tick,
.get_name = replay_filter_get_name,
.get_properties = replay_filter_properties,
.filter_video = replay_filter_video,
Expand Down
5 changes: 5 additions & 0 deletions replay-filter-audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ static obs_properties_t *replay_filter_properties(void *unused)
return props;
}

static void replay_filter_tick(void *data, float seconds){
replay_filter_check(data);
}

struct obs_source_info replay_filter_audio_info = {
.id = REPLAY_FILTER_AUDIO_ID,
.type = OBS_SOURCE_TYPE_FILTER,
Expand All @@ -92,6 +96,7 @@ struct obs_source_info replay_filter_audio_info = {
.destroy = replay_filter_destroy,
.update = replay_filter_update,
.load = replay_filter_update,
.video_tick = replay_filter_tick,
.get_name = replay_filter_get_name,
.get_properties = replay_filter_properties,
.filter_remove = replay_filter_remove,
Expand Down
6 changes: 3 additions & 3 deletions replay.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ struct obs_audio_data *replay_filter_audio(void *data,
cur_duration = adjusted_time - cached.timestamp;
}
pthread_mutex_unlock(&filter->mutex);
replay_filter_check(filter);
return audio;
}

Expand Down Expand Up @@ -149,10 +148,11 @@ const char *obs_module_author(void)
return "Exeldro";
}

void replay_filter_check(struct replay_filter *filter)
void replay_filter_check(void *data)
{
struct replay_filter *filter = data;
if (filter->last_check &&
filter->last_check + SEC_TO_NSEC > obs_get_video_frame_time())
filter->last_check + 3 * SEC_TO_NSEC > obs_get_video_frame_time())
return;
filter->last_check = obs_get_video_frame_time();
obs_source_t *s =
Expand Down
2 changes: 1 addition & 1 deletion replay.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct obs_audio_data *replay_filter_audio(void *data,
void free_video_data(struct replay_filter *filter);
void free_audio_data(struct replay_filter *filter);
void replay_trigger_threshold(void *data);
void replay_filter_check(struct replay_filter *filter);
void replay_filter_check(void *data);

#define REPLAY_FILTER_ID "replay_filter"
#define REPLAY_FILTER_AUDIO_ID "replay_filter_audio"
Expand Down

0 comments on commit 319f080

Please sign in to comment.