[FFmpeg-devel] [PATCH 2/2] dshow: handle events in graph
Don Moir
donmoir at comcast.net
Thu Dec 6 02:54:41 CET 2012
> From: "Ramiro Polla" <ramiro.polla at gmail.com>
> To: "FFmpeg development discussions and patches" <ffmpeg-devel at ffmpeg.org>
> Sent: Tuesday, December 04, 2012 1:23 AM
> Subject: [FFmpeg-devel] [PATCH 2/2] dshow: handle events in graph
>
>
>> Hi,
>>
>> Thanks to Don Moir for pointing out the problem and providing a fix.
>>
>> Don, could you please test that this patch fixes the problem for you?
>>
>> Ramiro
>>
> Ramiro, your patch sort of works but had a couple bugs.
>
> o - fixes return value in dshow_read_header. Your patch for this had a couple misplaced ')' in it.
>
> o - re-added ctx->eof. After the device has failed, this is a check to stop trying to read any more packets in dshow_read_packet.
> Without this check and someone calls av_read_frame after it has already failed will result in a hang.
>
> o - dshow_check_event_queue did not free the event when eof was detected. I modified it to take the ctx struct instead of media
> event so that ctx->eof could be set.
>
> o - added CoUninitialize to dshow_read_close. Every call to CoInitialize should have a matching CoUnititalize. Changed the
> position
> of CoInitialize in dshow_read_header so we always know to call CoUnintialize without flagging it.
>
> With event handling added to dshow.c and fix for ret value in dshow_read_header I can't get any abnormal behavior like hangs.
> Without the changes I can get to fail in at least 3 different ways.
>
> I will be working in the area of camera support for awhile and will continue to test. So if any kind of modifications to dshow
> support or device listing is wanted, now would be a good time for them.
>
> Ramiro, please review the attached modified dshow.c
>
> Don
Attached dshow.c and dshow.diff. diff is from current dshow.c and attached dshow.c
Had to move the position of ICreateDevEnum_Release in dshow_read_header since on error dshow_read_close is called which now calls
CoUninitialize.
static int dshow_read_header(AVFormatContext *avctx)
{
...
error:
- if (ret < 0)
- dshow_read_close(avctx);
- if (devenum)
- ICreateDevEnum_Release(devenum);
+ if (devenum)
+ ICreateDevEnum_Release(devenum);
+ if (ret < 0)
+ dshow_read_close(avctx);
return ret;
}
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dshow.c
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121205/42efd9e7/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dshow.diff
Type: application/octet-stream
Size: 7905 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121205/42efd9e7/attachment.obj>
More information about the ffmpeg-devel
mailing list