Opened 13 years ago

Closed 13 years ago

#10 closed defect (fixed)

rtsp method PLAY fails (status_code = 400) with some locales (non-English like)

Reported by: Ivan Owned by: Michael Niedermayer
Priority: normal Component: avformat
Version: Keywords: rtsp
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


In libavformat/rtspdec.c:

snprintf(cmd, sizeof(cmd),

"Range: npt=%0.3f-\r\n",
(double)rt->seek_timestamp / AV_TIME_BASE);

"cmd" can contain "Range: npt=0,000-" instead of "Range: npt=0.000-"
bacause of some applications use a locale with a comma as a decimal delimiter.
This case RTSP request will return a status code 400 (Bad Request).
xxprintf functions use current locale settings, see <locale.h>

I tried to play a RTSP stream in a Qt library based application.
Result: av_open_input_file fails, but a non-Qt applications and tutorials play streaming video. Tracing a source of error I found that "Range: npt=0,000-" sent with a PLAY method. Qt changes ansi C locale to a current system locale. Default decimal delimiter is a comma in my case. It was a reason of my troubles. Now I call setlocale(LC_ALL, "C") before open a stream to make some fast crutch.

Attachments (1)

patchrtspticket10 (980 bytes ) - added by Carl Eugen Hoyos 13 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 by Carl Eugen Hoyos, 13 years ago

Could you test attached modification?

by Carl Eugen Hoyos, 13 years ago

Attachment: patchrtspticket10 added

comment:2 by Ivan, 13 years ago

This modification works. Thanks you.

comment:3 by Carl Eugen Hoyos, 13 years ago

Resolution: fixed
Status: newclosed

Fixed in latest git.
Thank you for the very helpful report!

Note: See TracTickets for help on using tickets.