Ticket #10: patchrtspticket10

File patchrtspticket10, 980 bytes (added by cehoyos, 6 years ago)
Line 
1diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
2index 95b8690..094ee1f 100644
3--- a/libavformat/rtspdec.c
4+++ b/libavformat/rtspdec.c
5@@ -59,9 +59,14 @@ static int rtsp_read_play(AVFormatContext *s)
6         if (rt->state == RTSP_STATE_PAUSED) {
7             cmd[0] = 0;
8         } else {
9-            snprintf(cmd, sizeof(cmd),
10-                     "Range: npt=%0.3f-\r\n",
11-                     (double)rt->seek_timestamp / AV_TIME_BASE);
12+            if (!rt->seek_timestamp) {
13+                snprintf(cmd, sizeof(cmd), "Range: npt=0.000-\r\n");
14+           } else {
15+                snprintf(cmd, sizeof(cmd),
16+                         "Range: npt=%"PRId64".%03"PRId64"-\r\n",
17+                         rt->seek_timestamp / AV_TIME_BASE,
18+                         rt->seek_timestamp / (AV_TIME_BASE / 1000) % 1000);
19+            }
20         }
21         ff_rtsp_send_cmd(s, "PLAY", rt->control_uri, cmd, reply, NULL);
22         if (reply->status_code != RTSP_STATUS_OK) {