Commit ccc8141b authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Alexandre Julliard

winegstreamer: Send EOS on exiting thread.

parent 6c35f135
......@@ -411,11 +411,13 @@ static void release_sample(void *data) {
}
static DWORD CALLBACK push_data(LPVOID iface) {
LONGLONG maxlen, curlen;
GSTImpl *This = iface;
IMediaSample *buf;
DWORD_PTR user;
HRESULT hr;
IAsyncReader_Length(This->pInputPin.pReader, &maxlen, &curlen);
TRACE("Starting..\n");
for (;;) {
REFERENCE_TIME tStart, tStop;
......@@ -428,7 +430,11 @@ static DWORD CALLBACK push_data(LPVOID iface) {
if (FAILED(hr))
break;
if (This->nextofs >= maxlen)
break;
len = IMediaSample_GetSize(buf);
if (This->nextofs + len > maxlen)
len = maxlen - This->nextofs;
tStart = MEDIATIME_FROM_BYTES(This->nextofs);
tStop = tStart + MEDIATIME_FROM_BYTES(len);
......@@ -451,7 +457,7 @@ static DWORD CALLBACK push_data(LPVOID iface) {
gstbuf = gst_app_buffer_new(data, IMediaSample_GetActualDataLength(buf), release_sample, buf);
if (!gstbuf) {
IMediaSample_Release(buf);
return S_OK;
break;
}
gstbuf->duration = gstbuf->timestamp = -1;
ret = gst_pad_push(This->my_src, gstbuf);
......@@ -469,6 +475,8 @@ static DWORD CALLBACK push_data(LPVOID iface) {
break;
}
gst_pad_push_event(This->my_src, gst_event_new_eos());
TRACE("Almost stopping.. %08x\n", hr);
do {
IAsyncReader_WaitForNext(This->pInputPin.pReader, 0, &buf, &user);
......@@ -1447,6 +1455,8 @@ static HRESULT GST_RemoveOutputPins(GSTImpl *This) {
GSTOutPin **ppOldPins = This->ppPins;
TRACE("(%p)\n", This);
if (!This->gstfilter)
return S_OK;
gst_element_set_state(This->gstfilter, GST_STATE_NULL);
gst_pad_unlink(This->my_src, This->their_sink);
This->my_src = This->their_sink = NULL;
......
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