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 2D92445C55 for ; Wed, 29 Mar 2023 23:41:43 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 29F7C68C29D; Thu, 30 Mar 2023 02:41:39 +0300 (EEST) Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 752FB68C28D for ; Thu, 30 Mar 2023 02:41:32 +0300 (EEST) Received: by mail-oi1-f171.google.com with SMTP id y184so12939405oiy.8 for ; Wed, 29 Mar 2023 16:41:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680133290; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=IOq9rVlyyoiSDdiFs0887L/UDYwP7UGnl3NnaVa/6MQ=; b=oiOT2mnZPThuoCRekd1Rlwns0XXgEV7iodwTiERB6Z1qO/ySl5z0TnQmcMEbcVHyyr /hxgQd9ICjAGcOWaugcyrMyYyPYV/3FHlnnM4MmCj8PsLcqO4JMPca3THcCaxpsZkfjp rO5jae00p4tMfT9/lwZeFlSuYoqYWRCbZiw5UhwFAH85dCqUzB+AZzoH0n9LWIyCIF0z 9AL1LPrAg7coznmqlIonc5FsAcJZzPZFiXz/aKT5ZKt+nm5qdsEoxdfCLnQQO9sSDY2C ViZ8PC9y2KIXQScfz5sy02raQAuhUx1EGjJXL/GwyGPzhNAqCxgFokHheFBHr9MDiGZn pDgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680133290; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IOq9rVlyyoiSDdiFs0887L/UDYwP7UGnl3NnaVa/6MQ=; b=oslgn/nECbGh4pvf5aq0DnGD4V5+Agr/z2wtoRoLbyWW4lveNpRMkpOB065nHojij8 Xk272By0yxo5HxaGbJ3jlG2JBzizzf9COnKeqctsmC1NjFUEtF1l0I2IUK1r1f+uE6bZ DzSIKVpiXHCwIOoyjVVYrh7x9zEcaOkXOb/UFsq4BGsKa4w9W3k2vPC+bcTTpxG+dzh6 fMyU1tsiIaaF5UC9MvgE7Ikl/ausvgzdoP/wsM7+VP3I+5KuSTfSUksmu9Zx3QCZMoNw jbxoBZvJ+hmchFttcMR7jxofoB0Mx/6J32/rKJF2wcEc9tqKJYu5ghWua0T9npdP78N8 yyFQ== X-Gm-Message-State: AAQBX9dKfGRqEaZQoWfS87bl0xGBoOCGOkTAGEEl8Z4IidR2lv4V2rIj i+WSFh4Yx/o8o2AHL+XEh0bqxWOdWB0= X-Google-Smtp-Source: AKy350azlY4JUCaEDsoMHUj5Zzqx9PZjDqvup8wFPPTbcGUwmC1Cv9CBAWV/EwHYLN+cDxCAAlMBOA== X-Received: by 2002:a05:6808:904:b0:389:4a4c:a7f with SMTP id w4-20020a056808090400b003894a4c0a7fmr2070232oih.19.1680133290652; Wed, 29 Mar 2023 16:41:30 -0700 (PDT) Received: from [192.168.0.14] (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id s195-20020acaa9cc000000b00387384dc768sm8829570oie.9.2023.03.29.16.41.29 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Mar 2023 16:41:29 -0700 (PDT) Message-ID: Date: Wed, 29 Mar 2023 20:41:28 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20230325191529.10578-1-anton@khirnov.net> <20230325191529.10578-7-anton@khirnov.net> From: James Almer In-Reply-To: <20230325191529.10578-7-anton@khirnov.net> Subject: Re: [FFmpeg-devel] [PATCH 07/23] fftools/sync_queue: allow requesting a specific number of audio samples 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 3/25/2023 4:15 PM, Anton Khirnov wrote: > +static void offset_audio(AVFrame *f, int nb_samples) > +{ > + const int planar = av_sample_fmt_is_planar(f->format); > + const int planes = planar ? f->ch_layout.nb_channels : 1; > + const int bps = av_get_bytes_per_sample(f->format); > + const int offset = nb_samples * bps * (planar ? 1 : f->ch_layout.nb_channels); > + > + av_assert0(bps > 0); > + av_assert0(nb_samples < f->nb_samples); > + > + for (int i = 0; i < planes; i++) { > + f->extended_data[i] += offset; This apparently can end up unaligned. It's (afaict) the source of the segmentation fault Michael reported. If you run his command with -cpuflags 0 it doesn't crash. You may need to allocate a new frame and copy the data instead of making a reference in such scenarios. > + if (i < FF_ARRAY_ELEMS(f->data)) > + f->data[i] = f->extended_data[i]; > + } > + f->linesize[0] -= offset; > + f->nb_samples -= nb_samples; > + f->duration = av_rescale_q(f->nb_samples, (AVRational){ 1, f->sample_rate }, > + f->time_base); > + f->pts += av_rescale_q(nb_samples, (AVRational){ 1, f->sample_rate }, > + f->time_base); > +} _______________________________________________ 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".