Attempt to fix random crash that happen with the Windows native renderer and the VideoFlipEffect.

cusax-fix
Sebastien Vincent 15 years ago
parent 86f718dee2
commit e80a62b8e6

@ -95,10 +95,10 @@ jboolean JAWTRenderer_paint
if(!blitter->device->validate())
{
blitter->lost = true;
return JNI_TRUE;
blitter->lost = true;
return JNI_TRUE;
}
blitter->device->render(blitter->surface);
return JNI_TRUE;
}
@ -119,6 +119,9 @@ jboolean JAWTRenderer_process
if(!blitter->device || blitter->width != width || blitter->height != height
|| blitter->lost)
{
D3DSurface* oldSurface = NULL;
D3DDevice* oldDevice = NULL;
blitter->lost = false;
/* size has changed, recreate our device and surface */
@ -134,6 +137,11 @@ jboolean JAWTRenderer_process
blitter->device = NULL;
}
if(blitter->hwnd == NULL)
{
return JNI_TRUE;
}
blitter->device = blitter->d3d->createDevice(blitter->hwnd, width,
height);
@ -141,6 +149,7 @@ jboolean JAWTRenderer_process
{
/* device creation failed */
blitter->surface = NULL;
/* maybe we go fullscreen and/or hwnd of the window has changed
* so we return true to force native method to be called and so
* update blitter->hwnd for the next call

@ -72,7 +72,7 @@ D3DDevice::~D3DDevice()
{
if(m_backSurface)
{
m_backSurface->Release();
//m_backSurface->Release();
}
if(m_device)

@ -354,12 +354,16 @@ public synchronized int process(Buffer buffer)
}
Component component = getComponent();
boolean repaint
= process(
boolean repaint = false;
synchronized(this)
{
repaint = process(
handle,
component,
(int[]) buffer.getData(), buffer.getOffset(), bufferLength,
size.width, size.height);
}
if (repaint)
component.repaint();

@ -116,7 +116,7 @@ public Format[] getSupportedOutputFormats(Format input)
return new Format[]
{
(Format)input.clone(),
(Format)input.clone(),
};
}
@ -150,7 +150,7 @@ public Format setOutputFormat(Format format)
* @throws ResourceUnavailableException If all of the required resources
* cannot be acquired.
*/
public void open() throws ResourceUnavailableException
public synchronized void open() throws ResourceUnavailableException
{
graph = FFmpeg.avfilter_alloc_filtergraph();
inputstream = FFmpeg.avfilter_alloc_inputstream();
@ -160,7 +160,7 @@ public void open() throws ResourceUnavailableException
/**
* Closes this effect.
*/
public void close()
public synchronized void close()
{
if(graph != 0)
{
@ -202,7 +202,7 @@ public String getName()
* @return <tt>BUFFER_PROCESSED_OK</tt> if the processing is successful.
* @see PlugIn
*/
public int process(Buffer inputBuffer, Buffer outputBuffer)
public synchronized int process(Buffer inputBuffer, Buffer outputBuffer)
{
int ret = 0;

Loading…
Cancel
Save