Module: wine Branch: master Commit: ccc8141b8298d48ca25fcc0cced3e58b0600314f URL: http://source.winehq.org/git/wine.git/?a=commit;h=ccc8141b8298d48ca25fcc0cce...
Author: Maarten Lankhorst m.b.lankhorst@gmail.com Date: Sun Nov 7 16:13:55 2010 +0100
winegstreamer: Send EOS on exiting thread.
---
dlls/winegstreamer/gstdemux.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index d94c69a..3dabcc6 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -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;