From patchwork Tue Jul 18 21:45:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 42812 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:b813:b0:130:ccc6:6c4b with SMTP id fi19csp781429pzb; Tue, 18 Jul 2023 14:46:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlF6c2ypM6MsmwdvmoEFNNrbMA6GVxs6ltkrz0dv7IgWJ4BCEtqJ94atcYLAW4vw+fx2gQCZ X-Received: by 2002:aa7:d444:0:b0:51d:9195:400f with SMTP id q4-20020aa7d444000000b0051d9195400fmr911336edr.17.1689716772567; Tue, 18 Jul 2023 14:46:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689716772; cv=none; d=google.com; s=arc-20160816; b=m6VHZXrGy6OGdiwznw0riXmrQf0VRyzR6Yi30FH7Xa4EvVNR1jjnOI5cNZiCFukZdl ChQP2Sy3ziiALLJ0o7TGxjsDQMc6F2qjqSeUQ2spH+7tWrn6cx9ZDLCmB+51yqYK9Z8A 2i9eHuqGsSz0ke72/ZOtff9m2a/yxjPd56inTnTYcTNFlsRyx0r65yENnJwAyvPPnVOY z3m6176+xR7/BKhOTAx2ZoeAmR86Aopl7+XY4j64dj9jhxqKjB0kHXIGBFmhfAP5atAK I8MWt+yhGUT6RvXhYZ5ZNEyA5ibKF0M8c5MBdb+K+Vo1HcOwZu8y8b/8GUImqAVJ5prM kUGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=OwajR5YgaNQqt/IEhFkCbXsn5NgX+84lftCb76EXkYo=; fh=YYwLYmpaV0Fpw/rxmSKNRLS2XzDkAlGbHATiKOPtZrY=; b=XMLVnNgURfpVQ3TQykgEtqSCDZeMyBfxEQaBACLlI76VRzFc+BVateeSQ5HvOVHu06 nv/7C4oheUfN7ayw/nGSVFstOWJ55dUlBmjd7SbL5cJ9ltlzYn7HYMKOmCfbumlH3pWW Xhimy0yqhWSdLnFOgJbIeJXLcYM/qy9xmbs2g4H5bmnvw5vgx31mQi62HVUb1k4w37hm QRVfosENZCynOs6+LHtpnagiAapyMaij0pm4nc599bg8LiV8ptdVXD6yjtmrCmKtq8EH YdOaBm4paFdh795crwRa2RE5tWv144lkT1xdSmIn4tDA0CtZhZW22FIQ+L7+TefczzpI /BsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id g8-20020aa7c588000000b0051da08decbdsi1893349edq.636.2023.07.18.14.46.12; Tue, 18 Jul 2023 14:46:12 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 424F068C586; Wed, 19 Jul 2023 00:45:54 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8703068C557 for ; Wed, 19 Jul 2023 00:45:46 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id DE3AE1BF204 for ; Tue, 18 Jul 2023 21:45:45 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 18 Jul 2023 23:45:31 +0200 Message-Id: <20230718214542.685375-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230718214542.685375-1-michael@niedermayer.cc> References: <20230718214542.685375-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 03/14] avradio/sdrdemux: Fix seeking to stations at the edge of the range 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: suZwEYTEe+0v Signed-off-by: Michael Niedermayer --- libavradio/sdrdemux.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavradio/sdrdemux.c b/libavradio/sdrdemux.c index 6b1553b130..ca0a9c5cf9 100644 --- a/libavradio/sdrdemux.c +++ b/libavradio/sdrdemux.c @@ -1322,6 +1322,7 @@ static int snap2station(SDRContext *sdr, int *seek_direction) { av_assert0(!best_station || best_station != sst->station); if (best_station) { + int64_t wanted_freq = av_clip64(lrint(best_station->frequency + 213*1000), sdr->min_center_freq, sdr->max_center_freq); // We target a bit off teh exact frequency to avoid artifacts int ret = setup_stream(sdr, sdr->single_ch_audio_st_index, best_station); if (ret < 0) { av_log(avfmt, AV_LOG_DEBUG, "setup_stream failed\n"); @@ -1331,7 +1332,7 @@ static int snap2station(SDRContext *sdr, int *seek_direction) { pthread_mutex_lock(&sdr->mutex); *seek_direction = sdr->seek_direction = 0; - sdr->wanted_freq = lrint(best_station->frequency + 213*1000); // We target a bit off teh exact frequency to avoid artifacts + sdr->wanted_freq = wanted_freq; //200*1000 had artifacts av_log(avfmt, AV_LOG_DEBUG, "request f = %"PRId64"\n", sdr->wanted_freq);