Commit 6ba6a3a2 authored by Ghislain MARY's avatar Ghislain MARY

Fix uninitialization of filters on Windows 10.

parent e3484a18
......@@ -68,8 +68,7 @@ static void ms_wasapi_read_postprocess(MSFilter *f) {
}
static void ms_wasapi_read_uninit(MSFilter *f) {
MSWASAPIReaderPtr ptr = static_cast<MSWASAPIReaderPtr>(f->data);
delete ptr;
MSWASAPIReaderDelete(static_cast<MSWASAPIReaderPtr>(f->data));
}
......@@ -197,8 +196,7 @@ static void ms_wasapi_write_postprocess(MSFilter *f) {
}
static void ms_wasapi_write_uninit(MSFilter *f) {
MSWASAPIWriterPtr ptr = static_cast<MSWASAPIWriterPtr>(f->data);
delete ptr;
MSWASAPIWriterDelete(static_cast<MSWASAPIWriterPtr>(f->data));
}
......
......@@ -333,9 +333,19 @@ MSWASAPIReaderPtr MSWASAPIReaderNew()
r->reader = Make<MSWASAPIReader>();
return r;
}
void MSWASAPIReaderDelete(MSWASAPIReaderPtr ptr)
{
ptr->reader->setAsNotInstantiated();
ptr->reader = nullptr;
delete ptr;
}
#else
MSWASAPIReaderPtr MSWASAPIReaderNew()
{
return (MSWASAPIReaderPtr) new MSWASAPIReader();
}
void MSWASAPIReaderDelete(MSWASAPIReaderPtr ptr)
{
delete ptr;
}
#endif
......@@ -50,6 +50,8 @@ public:
int getNChannels() { return mNChannels; }
#ifdef MS2_WINDOWS_UNIVERSAL
void setAsNotInstantiated() { smInstantiated = false; }
// IActivateAudioInterfaceCompletionHandler
STDMETHOD(ActivateCompleted)(IActivateAudioInterfaceAsyncOperation *operation);
#endif
......@@ -95,3 +97,4 @@ typedef MSWASAPIReader* MSWASAPIReaderType;
#endif
MSWASAPIReaderPtr MSWASAPIReaderNew();
void MSWASAPIReaderDelete(MSWASAPIReaderPtr ptr);
......@@ -338,9 +338,19 @@ MSWASAPIWriterPtr MSWASAPIWriterNew()
w->writer = Make<MSWASAPIWriter>();
return w;
}
void MSWASAPIWriterDelete(MSWASAPIWriterPtr ptr)
{
ptr->writer->setAsNotInstantiated();
ptr->writer = nullptr;
delete ptr;
}
#else
MSWASAPIWriterPtr MSWASAPIWriterNew()
{
return (MSWASAPIWriterPtr) new MSWASAPIWriter();
}
void MSWASAPIWriterDelete(MSWASAPIWriterPtr ptr)
{
delete ptr;
}
#endif
......@@ -50,6 +50,8 @@ public:
int getNChannels() { return mNChannels; }
#ifdef MS2_WINDOWS_UNIVERSAL
void setAsNotInstantiated() { smInstantiated = false; }
// IActivateAudioInterfaceCompletionHandler
STDMETHOD(ActivateCompleted)(IActivateAudioInterfaceAsyncOperation *operation);
#endif
......@@ -97,3 +99,4 @@ typedef MSWASAPIWriter* MSWASAPIWriterType;
#endif
MSWASAPIWriterPtr MSWASAPIWriterNew();
void MSWASAPIWriterDelete(MSWASAPIWriterPtr ptr);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment