From patchwork Thu Feb 9 17:40:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Converse X-Patchwork-Id: 2467 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp102431vsb; Thu, 9 Feb 2017 09:49:49 -0800 (PST) X-Received: by 10.28.216.14 with SMTP id p14mr22138697wmg.56.1486662589155; Thu, 09 Feb 2017 09:49:49 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id d12si13679418wrb.170.2017.02.09.09.49.47; Thu, 09 Feb 2017 09:49:49 -0800 (PST) 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; dkim=neutral (body hash did not verify) header.i=@gmail.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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E0545689D69; Thu, 9 Feb 2017 19:49:41 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg0-f65.google.com (mail-pg0-f65.google.com [74.125.83.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 83A9E68920B for ; Thu, 9 Feb 2017 19:49:35 +0200 (EET) Received: by mail-pg0-f65.google.com with SMTP id 194so862448pgd.0 for ; Thu, 09 Feb 2017 09:49:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ETpq/aIHFEwpDXUEYGtx1msyWWBZ5IEY2c6aMoBgg/U=; b=hXsxKImEBQ81KlM9AR3+LlijXc8P5kx3wxydsXttIOLobGbk84yy1JYlZlLJ1eCZ3A Jr0oDGdBTf9GhkTz/a8j1WYh59SjpWuY31U8lh+dfs96Qo+uUGk6S5bhGCVsyCXLslLB UceeVYKqqzKCPjDQb+yRgJ8eoYULJClflWx8ROYgXK4rXHrW9+GDBIKgn4w1ZZ0cC4VM GwR7tc97uZotpoDgnRo8xTxnGXgRAnDKqoaTVxuaWkd4lKt4FCUcDx2kj7qvVFiFU+NC 7gk8jb0C6LSPIcvbmWuz0/xiIavvi2snV2I5loAwcAXkFUfu3HXBf5bPWPxKhVKqDVsY X3Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ETpq/aIHFEwpDXUEYGtx1msyWWBZ5IEY2c6aMoBgg/U=; b=Tr3/6T6qQZXBEIBsO98LQs5oW+AszHfR/FgRhuDV3fPzjxOEn835962tYpM/VDymPJ sYsm00oMhnMwUaazLziOX30NH7yMkzt/S/BVu+2NJEC3obV4rQsQRycdc97RBlOsSNMz xe6x7vd9M21Q8xbGfok3exTemG6iAz20fTDtTkAPI+Cpl2Q1UKagXhcHvdY04YmczjE7 ZbjEQISbOwCYwpYckIkZnnjTlaXJheUexm6i0yDlf3mLoViy1wZkWqtXUP27fk8qabhU TKi8B8poAo3T1VzahswkCFVCynzrsmRs+tldGCOT0QUSddmBHN/ENQcOR8/SIEpef2Fk BPuA== X-Gm-Message-State: AMke39mE+GrYjXIHopKYx5YIbL2+DaVDE6qimRFYqflcJS/iRTYu3AonS4nVep3GiiLilg== X-Received: by 10.99.99.5 with SMTP id x5mr5334658pgb.225.1486662072874; Thu, 09 Feb 2017 09:41:12 -0800 (PST) Received: from terok.mtv.corp.google.com ([172.22.116.121]) by smtp.gmail.com with ESMTPSA id g70sm30488524pfb.50.2017.02.09.09.41.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Feb 2017 09:41:12 -0800 (PST) From: Alex Converse To: ffmpeg-devel@ffmpeg.org Date: Thu, 9 Feb 2017 09:40:39 -0800 Message-Id: <20170209174039.8218-4-alex.converse@gmail.com> X-Mailer: git-send-email 2.11.0.483.g087da7b7c-goog In-Reply-To: <20170209174039.8218-1-alex.converse@gmail.com> References: <20170209174039.8218-1-alex.converse@gmail.com> Subject: [FFmpeg-devel] [PATCH 4/4] aac_latm: Align inband PCE to the start of the payload X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Cc: Alex Converse MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" A strict reading of the spec seems to imply that it should be aligned to the start of the element instance tag, but that would break all of the samples with PCEs. It seems like a well formed LATM stream should have its PCE in the ASC rather than inband. Fixes ticket 4544 --- libavcodec/aacdec_template.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index 6654416e69..1f14a1cbae 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -2949,6 +2949,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, int err, elem_id; int samples = 0, multiplier, audio_found = 0, pce_found = 0; int is_dmono, sce_count = 0; + int payload_alignment; ac->frame = data; @@ -2971,6 +2972,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, // This may lead to an undefined profile being signaled ac->avctx->profile = ac->oc[1].m4ac.object_type - 1; + payload_alignment = get_bits_count(gb); ac->tags_mapped = 0; // parse while ((elem_type = get_bits(gb, 3)) != TYPE_END) { @@ -3025,7 +3027,8 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, uint8_t layout_map[MAX_ELEM_ID*4][3]; int tags; push_output_configuration(ac); - tags = decode_pce(avctx, &ac->oc[1].m4ac, layout_map, gb, 0); + tags = decode_pce(avctx, &ac->oc[1].m4ac, layout_map, gb, + payload_alignment); if (tags < 0) { err = tags; break;