From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id D015947114 for ; Sun, 27 Aug 2023 14:43:36 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6282268C41B; Sun, 27 Aug 2023 17:43:33 +0300 (EEST) Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7803068041B for ; Sun, 27 Aug 2023 17:43:26 +0300 (EEST) Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-d746d030a86so2364188276.1 for ; Sun, 27 Aug 2023 07:43:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693147405; x=1693752205; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=A65JMUyqV+70XzllPqw9DM0NHKrwFk8DUCDsxCdWq8g=; b=BVS4IFGS++qritgMFGqiZELhF95sb0gcCevFreNfkSROVQvTMlp7SfQo98Zwx/xZB+ ZQEyzmlY6Oa2RaXXN0ePrqdVWBGY2oFLJtbGshR3poCG/zdPgXcbGs/xRpcI8pk4AAwP W+4VrfBHt6ImnfkVAB5DPDHLyNwYuHVKonQlXQz/u5CVtaJ/OfvkyEJwEAqUArP5eoyR btAHS6NOVcwsY1Q/Yx9aPY5JQDtY18E+70jGDTuvdGIL2Rhr8hlcr0qs6+Yv9LWlUJ2v o0RrF2dLpn8aUAiXG8hTqkMd5PGtssf+xknfycAqZjF95lx+m3+RJG8huPaovyzKE4iL 27gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693147405; x=1693752205; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=A65JMUyqV+70XzllPqw9DM0NHKrwFk8DUCDsxCdWq8g=; b=ZUoPrKtN9DfKFWJbaaA1/8Z2l8wzqOmqgGd/QtFauA2ck/SOhPnPvlZ05yqoW+/UzZ OlcEhc0y+twbN+HPKS0OVuIFQANc++oEt2fIBnR14QgEq/wyH7LpPEbIC+DDuBwl9CIH PTtswb+YTIucjAmHvoDOJKoYQ5TYR7mCY+arfkUgRvCF1qNGrHN4qEo09YJiDG9+XpqT V19D/xDtE2OFDW9Ip8GeUYIItmgJhszPOvwFLbqTJ1Iy4q7ZTLNgw0XBMVdt6RcQ8jpF YSxnz9SYIjfkXOvSM1REFbNqrfcaJQqQZB8/TZpolY3BnwN/T+T/9PSNjCdtplfskG37 6WgQ== X-Gm-Message-State: AOJu0YyFxsmJEKmKq244fW30avv3rz4xzlcRSMiCwIqP+mlJYTO5XQbh HBJjXttdSrduP4VZZyASAj0gHYOJTEp1V+11UcAzE1Os1wA= X-Google-Smtp-Source: AGHT+IGa38fXfu4ZbUvCnzVQU1Yb4vlLK50GVBmQR97CK3o7YK2WinOgnVVXA7zsMcWPSDKVBEqg1Bj2MnVjmiK4ElU= X-Received: by 2002:a25:1e09:0:b0:d09:acfd:ff74 with SMTP id e9-20020a251e09000000b00d09acfdff74mr21810170ybe.60.1693147404603; Sun, 27 Aug 2023 07:43:24 -0700 (PDT) MIME-Version: 1.0 From: Tmc Tmc Date: Sun, 27 Aug 2023 09:43:13 -0500 Message-ID: To: ffmpeg-devel@ffmpeg.org X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [FFmpeg-devel] sending RTSP keep alive even when paused X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Hi All, I found a bug in ffmpeg's RTSP implementation. The workflow is as follows: 1. Have a RTSP server that supports Pause. 2. Have ffmpeg play a video from that server (rtsp://:...). 3. Pause the video in ffmpeg. 4. ffmpeg does NOT properly send the keep alive when Paused (either "GET_PARAMETER" or "OPTIONS"). This is the bug. 5. Since the RTSP server expects the keep alive, after the specified timeout (usually 60s) it closes the connection. The bug is in libavformat/rtspdec.c, rtsp_read_packet method. This method first does ff_rtsp_fetch_packet, which fails when the server is Paused, causing it to never send the "GET_PARAMETER" or "OPTIONS" which is placed after this call. The fix is to simply move that block of code before ff_rtsp_fetch_packet. That is, move the entire if block: if (!(rt->rtsp_flags & RTSP_FLAG_LISTEN)) { ... } just before the call to: ret = ff_rtsp_fetch_packet(s, pkt); I have tested this and it seems to work well for our cases. Your thoughts and comments on this are welcome. Thanks. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".