Skip to content

Commit

Permalink
Fixed crashes caused seeking video from second thread
Browse files Browse the repository at this point in the history
  • Loading branch information
bjakja committed Nov 5, 2020
1 parent c3d8cc4 commit f926af9
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 133 deletions.
4 changes: 3 additions & 1 deletion Kaiplayer/AudioDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ bool AudioDisplay::InitDX(const wxSize &size)
d3dpp.BackBufferCount = 1;
d3dpp.SwapEffect = D3DSWAPEFFECT_COPY;//D3DSWAPEFFECT_DISCARD;//D3DSWAPEFFECT_COPY;//
d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
//d3dpp.Flags = D3DPRESENTFLAG_VIDEO;
d3dpp.Flags = 0;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;//D3DPRESENT_INTERVAL_DEFAULT;

Expand Down Expand Up @@ -1201,6 +1200,9 @@ void AudioDisplay::UpdateSamples() {
if (!provider) return;
if (w) {
int64_t totalSamples = provider->GetNumSamples();
//to make not scaling with window change
//w to constant number for example 500
//spectrum posiotion have to changed that number too
int total = totalSamples / w;
int max = 5760000 / w; // 2 minutes at 48 kHz maximum
if (total > max) total = max;
Expand Down
3 changes: 3 additions & 0 deletions Kaiplayer/SubsGridBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,7 @@ bool SubsGridBase::IsModified()

void SubsGridBase::GetUndo(bool redo, int iter)
{
wxMutexLocker lock(editionMutex);
Freeze();
const wxString &resolution = GetSInfo(L"PlayResX") + L" x " + GetSInfo(L"PlayResY");
const wxString &matrix = GetSInfo(L"YCbCr Matrix");
Expand Down Expand Up @@ -1083,6 +1084,7 @@ void SubsGridBase::DummyUndo(int newIter)
{
if (newIter >= file->Iter())
return;
wxMutexLocker lock(editionMutex);
file->DummyUndo(newIter);
if (SpellErrors.size() > currentLine)
SpellErrors[currentLine].clear();
Expand Down Expand Up @@ -1169,6 +1171,7 @@ void SubsGridBase::GetSInfos(wxString &textSinfo, bool tld/*=false*/)
void SubsGridBase::SetModified(unsigned char editionType, bool redit, bool dummy, int SetEditBoxLine, bool Scroll)
{
if (file->IsNotSaved()){
wxMutexLocker lock(editionMutex);
if (!IsModified()){
Kai->Toolbar->UpdateId(GLOBAL_SAVE_SUBS, true);
Kai->Menubar->Enable(GLOBAL_SAVE_SUBS, true);
Expand Down
4 changes: 2 additions & 2 deletions Kaiplayer/VersionKainote.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
//StableReleaseLink: https://github.com/bjakja/Kainote/releases/download/v0.9.3.893/Kainote.x64.zip
//VersionKainoteX86: 0.9.3.910

#define VersionKainote "0.9.8.1209"
#define NumVersionKainote 0,9,8,1209
#define VersionKainote "0.9.8.1211"
#define NumVersionKainote 0,9,8,1211
10 changes: 8 additions & 2 deletions Kaiplayer/kainoteMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ void KainoteFrame::OnMenuSelected(wxCommandEvent& event)
tab->Video->ChangePositionByFrame((id == GLOBAL_PREVIOUS_FRAME) ? -1 : 1);
}

if (Options.CheckLastKeyEvent(id))
return;
//if (Options.CheckLastKeyEvent(id))
//return;

if (id == GLOBAL_SAVE_SUBS){
Save(false);
Expand Down Expand Up @@ -1668,6 +1668,12 @@ void KainoteFrame::SaveAll()
bool KainoteFrame::SavePrompt(char mode, int wtab)
{
TabPanel* atab = (wtab < 0) ? GetTab() : Tabs->Page(wtab);
if (!atab)
return false;
if (!atab->Grid)
return false;
if (!atab->Grid->file)
return false;
if (atab->Grid->IsModified()){
wxString ext = (atab->Grid->subsFormat == ASS) ? L"ass" : (atab->Grid->subsFormat == SRT) ? L"srt" : L"txt";
wxString subsExt;
Expand Down
Binary file modified en.mo
Binary file not shown.
Loading

0 comments on commit f926af9

Please sign in to comment.