Opened 15 months ago

Last modified 8 months ago

#5615 new defect

avformat_open_input on dead UDP source link hangs after interrupt_callback signaled exit

Reported by: Marlon Owned by:
Priority: important Component: avformat
Version: git-master Keywords: udp regression
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Udp source is not active.
After returning 1 from interrupt_callback (exit), avformat_open_input does not return.

Using Win32 dll from Zeranoe on W10 64bit, Microsoft compiler

2015-05-22 Working
https://ffmpeg.zeranoe.com/builds/win32/shared/ffmpeg-20160522-git-566be4f-win32-shared.7z

2015-05-25 Not working
https://ffmpeg.zeranoe.com/builds/win32/shared/ffmpeg-20160525-git-9591ca7-win32-shared.7z

How to reproduce:
GetTickCount? used can be any time function returning miliseconds.

unsigned long TimePrev=0;
//callback
static int cb_open(void *ctx) 
{
 //timeout after 3 seconds
 if(GetTickCount() - TimePrev > 3000)
  {
   printf("---interrupt_cb: Exit\n");
   return 1;
  }
 return 0;
}


void main()
{
 avformat_network_init();
 AVFormatContext *pFmtCtx = avformat_alloc_context();
 pFmtCtx->interrupt_callback.callback = cb_open;
 pFmtCtx->interrupt_callback.opaque = 0;

 const char *url="udp://127.0.0.1:8000";
 printf("avformat_open_input %s\n", url);
 TimePrev=GetTickCount();
 int nRet=avformat_open_input(&pFmtCtx, url, NULL, NULL);
 //here never called

Change History (12)

comment:1 follow-up: Changed 9 months ago by superware

Can a developer please check this (old) defect? it's very easy to reproduce... Thanks!

comment:2 in reply to: ↑ 1 ; follow-ups: Changed 9 months ago by cehoyos

Replying to superware:

Can a developer please check this (old) defect?

it's very easy to reproduce...

How can the issue be reproduced?

comment:3 Changed 9 months ago by cehoyos

  • Keywords open callback hang removed

comment:4 in reply to: ↑ 2 Changed 9 months ago by superware

Replying to cehoyos:

How can the issue be reproduced?

Hi cehoyos,

Simply open a non-existing UDP stream, such as "udp://127.0.0.1:8000", and avformat_open_input will hang even if the interrupt_callback.callback returns 1 ("During blocking operations, callback is called with opaque as parameter. If the callback returns 1, the blocking operation will be aborted.").

Actually all the details and code are supplied by Marlon above.

Thank you in advance.

comment:5 in reply to: ↑ 2 Changed 9 months ago by superware

Replying to cehoyos:

How can the issue be reproduced?

Hi cehoyos, have you managed to reproduce the bug? Thanks!

comment:6 Changed 8 months ago by superware

Marlon, do you have any new information regarding this issue?

comment:7 Changed 8 months ago by cehoyos

  • Keywords regression added
  • Priority changed from normal to important

Which change introduced the regression?

comment:8 Changed 8 months ago by superware

Thanks cehoyos.

Well, it seems Marlon found ffmpeg-20160522-git-566be4f-win32-shared.7z working but ffmpeg-20160525-git-9591ca7-win32-shared.7z not.

comment:9 Changed 8 months ago by cehoyos

Which of the 19 commits between 566be4f and 9591ca7 caused the regression?

comment:10 Changed 8 months ago by superware

I'm not sure. Have you managed to reproduce?

comment:11 Changed 8 months ago by cehoyos

How can the issue be reproduced?

comment:12 Changed 8 months ago by superware

Please see Marlon's code snippet in the description.

Note: See TracTickets for help on using tickets.