From patchwork Mon Jan 15 15:58:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sfan5 X-Patchwork-Id: 7292 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.78.2 with SMTP id r2csp3073463jaa; Mon, 15 Jan 2018 07:59:05 -0800 (PST) X-Google-Smtp-Source: ACJfBovebZ2lVShJJvg7Kg+HmtZAqEO7cePHwgyhlCcTGzQFoCnrUhAzFQjQYrItcW2PSITBgpRl X-Received: by 10.223.201.143 with SMTP id f15mr6118808wrh.192.1516031945675; Mon, 15 Jan 2018 07:59:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516031945; cv=none; d=google.com; s=arc-20160816; b=J0Jx+jcDkZkphZyk/lKU53E7Of83SgCGfL1L7NB2DJ/3XYV7mJ9FLmHCh9nBDBWIFl EzI+Q6pf+uf0eQEp3IlAkvXpK1o4Ojh66qrTWIoR4NmP8XeqJOGo0BbibWvfxSHlMBoH bT0dcgBHSSKtXXF/cOx3Qakj8eB8Ql2uQYt+koo0TUuLN+lLXhuQMptd3q9FJDHaP0f9 Hvm/hQdPExtSVxwsNqSQ5CT1mlR9+TWAvTpzw8vJ/R0Qwmit3bf7bVXBMaAaaXqS+/7w hOFTMKYd8GB0UbrPyU0u2yp4VCJjY9vu/WDySBsjqTUCzoJLRdEX88djNriqHwOGVEEb 0XRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:spamdiagnosticmetadata:spamdiagnosticoutput :content-language:accept-language:message-id:date:thread-index :thread-topic:to:from:delivered-to:arc-authentication-results; bh=lzAR3q4CRraZDkBLB97kF01fO6YmfCWRTk7oASjHULE=; b=LnvonhqzNQbciisCVSGWJn9h9EhStcbwYZgP/5zESCVtayfc6oXmC58bXpNVA2fu9P t3xXYbFwNnedT1KiwH2N4ELvLD72p1VSnhmtiY15yqF58u3fSRjAU6sYoxJytXDSfee/ Q/m5+jexTRC7wB/N00cQf+IBq2nxjxk6xOp4fPgVMXtC7HFwmO4utHMvWGvBpv8POLbt 3C51SUdnmys5DEb/NaC9hcflsyqM1W2MzIcKhLj9JQjRW5mx385N4Uy84DcqLN74tcqX 7sBZhLu8rnC612Atf5OG85Ao/z6EFDcq5DCaa+I/4dfQrldAxbCXJxGA+064+nrih+NK ysCA== 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 72si195806wmu.213.2018.01.15.07.59.04; Mon, 15 Jan 2018 07:59:05 -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; 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 EFC8C689FED; Mon, 15 Jan 2018 17:59:01 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-oln040092072108.outbound.protection.outlook.com [40.92.72.108]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 88AFC689AB3 for ; Mon, 15 Jan 2018 17:58:54 +0200 (EET) Received: from DB5EUR03FT055.eop-EUR03.prod.protection.outlook.com (10.152.20.55) by DB5EUR03HT134.eop-EUR03.prod.protection.outlook.com (10.152.21.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.345.5; Mon, 15 Jan 2018 15:58:55 +0000 Received: from DB3PR0202MB3452.eurprd02.prod.outlook.com (10.152.20.60) by DB5EUR03FT055.mail.protection.outlook.com (10.152.21.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.345.5 via Frontend Transport; Mon, 15 Jan 2018 15:58:55 +0000 Received: from DB3PR0202MB3452.eurprd02.prod.outlook.com ([fe80::f937:4ad2:ba75:414]) by DB3PR0202MB3452.eurprd02.prod.outlook.com ([fe80::f937:4ad2:ba75:414%13]) with mapi id 15.20.0407.009; Mon, 15 Jan 2018 15:58:55 +0000 From: Stefan _ To: FFmpeg development discussions and patches Thread-Topic: [PATCH] dashdec: Make use of frame rate specified in Representation Thread-Index: AQHTjhm+jw3AJT1zY0SHQm4dl51Peg== Date: Mon, 15 Jan 2018 15:58:54 +0000 Message-ID: Accept-Language: de-DE, en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:D624A312D6F410E9A8DA17F19C8E3582F81058BE0DF784DAC70ECCEB0B60704B; UpperCasedChecksum:29F6175A23B40AB4C9AED613C183F5FB27C8035C5889491130DE005DEB12B52A; SizeAsReceived:6969; Count:44 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [CznyICCyGHaxneIWoqWUOkg70ydkf8PM] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB5EUR03HT134; 6:ghPiVoDajLfWjpyZn44aIr6ojWs4VWZHFlSSEzURpUz7UkxZEm8nbaL746phdA7Iq8oHIFd3alJRgvj0NAFfMC77eyK7Lbtl9TXeaNrZ6l/gOfJa88Lac+TDu5lVLJl/N90tjwfIA1nITOMBkr7iL8QsiqK7qY3LJ4H8t0bqb2WRLd5fqbw2JQ0YhZoa2pbwh0D6OhPDmACkh2e2rk/Yb6qRUdUZUCnsMdtXvBTbMdUKjc2L+eIjnUgkeZIMJhn0EO5loIMqxXPJJYdq7UgLvpDYLGi/BE7GPy1ar84DYnlBe8yoGR0isVxHT9XgIO6HTOmy5pV0azKoxNcC9+yQGTBD423Az93ATtUIc3b/Jyk=; 5:D9MruRYlIlAI1fQqwaOfH70rSTummj16myqRfIPhnPO2WOcDy89cgtCzqFIlSX4uZZtT1adayO1DEqConuwy3LsYuEzR4iJ+hmVCTkkqrFqhNjGRDkztkD99btpIlULuMsKCojcfkfYE3TruVdTIFnGD1euOs1+44QdUp63Hqz4=; 24:h7dEOw6dpPmEd/UCu5eol0Mk19tAw6O3t5qMPZCTflbLF7XrIP5hdjUF4jGAFsBbHagppXwLwEy2CoXg/t106qI4+F+e2mbeioXfJQcv3N4=; 7:OfOqDFnoowpLyAurtDYHwlPOj/LDEmO5d7nfLFccdkQGEHxa4IH2Ww/O2Bx+cDEruAd9j39olqAkBv8uh9Q+amrQjr9xz2obHi2O1dkzFibbsadDcrXvxp79HxpWkKW1COvR9Et7s33Kruq2YxuXo8+FJD8qAjNBq2dhmhQduP5Ccvx4bQGKQ1AIzjMdEGet1h7XrhwNoS/rMSL44799RtvuaUuKl7xa7G6+MIKr2/WSmi3aVynP6XOYKTQRzbrs x-incomingheadercount: 44 x-eopattributedmessage: 0 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(201702061074)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322404)(1603101448)(1601125374)(1701031045); SRVR:DB5EUR03HT134; x-ms-traffictypediagnostic: DB5EUR03HT134: x-ms-office365-filtering-correlation-id: d423331b-25c9-4953-b43d-08d55c30e0d9 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(444000031); SRVR:DB5EUR03HT134; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DB5EUR03HT134; x-forefront-prvs: 0553CBB77A x-forefront-antispam-report: SFV:NSPM; SFS:(7070007)(98901004); DIR:OUT; SFP:1901; SCL:1; SRVR:DB5EUR03HT134; H:DB3PR0202MB3452.eurprd02.prod.outlook.com; FPR:; SPF:None; LANG:; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d423331b-25c9-4953-b43d-08d55c30e0d9 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jan 2018 15:58:54.9905 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5EUR03HT134 Subject: [FFmpeg-devel] [PATCH] dashdec: Make use of frame rate specified in Representation 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Hi, attached patch fixes an annoyance when playing DASH videos from e.g. YouTube: "mov,mp4,m4a,3gp,3g2,mj2: Stream #0: not enough frames to estimate rate; consider increasing probesize" From e0210059fb420ef2e6c6b0d89c7e733b99f78ee5 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Mon, 15 Jan 2018 16:48:29 +0100 Subject: [PATCH] dashdec: Make use of frame rate specified in Representation If the manifest provides this, setting r_frame_rate avoids warnings regarding frame rate estimation. --- libavformat/dashdec.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 2492f1d26..a080bf358 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -86,6 +86,7 @@ struct representation { enum AVMediaType type; char id[20]; int bandwidth; + AVRational framerate; AVStream *assoc_stream; /* demuxer stream associated with this representation */ int n_fragments; @@ -674,6 +675,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, xmlNodePtr representation_node = node; char *rep_id_val = xmlGetProp(representation_node, "id"); char *rep_bandwidth_val = xmlGetProp(representation_node, "bandwidth"); + char *rep_framerate_val = xmlGetProp(representation_node, "frameRate"); enum AVMediaType type = AVMEDIA_TYPE_UNKNOWN; // try get information from representation @@ -843,6 +845,13 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, rep->fragment_timescale = 1; rep->bandwidth = rep_bandwidth_val ? atoi(rep_bandwidth_val) : 0; strncpy(rep->id, rep_id_val ? rep_id_val : "", sizeof(rep->id)); + rep->framerate = av_make_q(0, 0); + if (type == AVMEDIA_TYPE_VIDEO && rep_framerate_val) { + ret = av_parse_video_rate(&rep->framerate, rep_framerate_val); + if (ret < 0) + av_log(s, AV_LOG_VERBOSE, "Ignoring invalid frame rate '%s'\n", rep_framerate_val); + } + if (type == AVMEDIA_TYPE_VIDEO) { rep->rep_idx = video_rep_idx; dynarray_add(&c->videos, &c->n_videos, rep); @@ -861,6 +870,8 @@ end: xmlFree(rep_id_val); if (rep_bandwidth_val) xmlFree(rep_bandwidth_val); + if (rep_framerate_val) + xmlFree(rep_framerate_val); return ret; } @@ -1571,7 +1582,7 @@ static int reopen_demux_for_component(AVFormatContext *s, struct representation AVInputFormat *in_fmt = NULL; AVDictionary *in_fmt_opts = NULL; uint8_t *avio_ctx_buffer = NULL; - int ret = 0; + int ret = 0, i; if (pls->ctx) { close_demux_for_component(pls); @@ -1618,6 +1629,13 @@ static int reopen_demux_for_component(AVFormatContext *s, struct representation if (ret < 0) goto fail; if (pls->n_fragments) { +#if FF_API_R_FRAME_RATE + if (pls->framerate.den) { + for (i = 0; i < pls->ctx->nb_streams; i++) + pls->ctx->streams[i]->r_frame_rate = pls->framerate; + } +#endif + ret = avformat_find_stream_info(pls->ctx, NULL); if (ret < 0) goto fail; -- 2.15.1