
{"id":10109,"date":"2022-06-21T09:10:49","date_gmt":"2022-06-21T09:10:49","guid":{"rendered":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/documentation\/rdk_video_documentation\/components\/open-sourced_components\/advanced_adaptive_media_player_aamp\/underflow_handling__stall_detection\/"},"modified":"2025-03-25T05:18:35","modified_gmt":"2025-03-25T05:18:35","slug":"underflow_handling__stall_detection","status":"publish","type":"page","link":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/underflow_handling__stall_detection\/","title":{"rendered":"Underflow Handling &#038; Stall Detection"},"content":{"rendered":"<p><!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\"><br \/>\n <html><body><\/p>\n<div class=\"contentLayout2\">\n<div class=\"columnLayout single\" data-layout=\"single\">\n<div class=\"cell normal\" data-type=\"normal\">\n<div class=\"innerCell\">\n<p>Default gstreamer buffering on devices that don&#8217;t support 4k content is by default:<\/p>\n<ul>\n<li>4096k for video<\/li>\n<li>512k for audio&nbsp;<\/li>\n<\/ul>\n<p><\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"columnLayout single\" data-layout=\"single\">\n<div class=\"cell normal\" data-type=\"normal\">\n<div class=\"innerCell\">\n<ul>\n<li>For 4k playback, the average 2s 4k fragment size is ~4096k<\/li>\n<li>This gives 6s (worst case) buffering in gstreamer, to complement the 3-fragment (6s) application managed buffering, for 12s of buffering in all.<\/li>\n<\/ul>\n<p><\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"columnLayout single\" data-layout=\"single\">\n<div class=\"cell normal\" data-type=\"normal\">\n<div class=\"innerCell\">\n<ul>\n<li>For non-4k playback, the biggest video fragments are typically under 1024k<\/li>\n<li>This gives 8s (worse case) buffering in gstreamer to complement the 3-fragment (6s) application managed buffering, for 14s of buffering in all.<\/li>\n<\/ul>\n<p><\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"columnLayout single\" data-layout=\"single\">\n<div class=\"cell normal\" data-type=\"normal\">\n<div class=\"innerCell\">\n<ul>\n<li>There is some additional more modest lower-level buffering in gstreamer feeding the video and audio decoders.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"columnLayout single\" data-layout=\"single\">\n<div class=\"cell normal\" data-type=\"normal\">\n<div class=\"innerCell\">\n<p><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <\/span>    <\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/sites\/16\/2023\/09\/AAMP%20UnderFlow%20States.png\"><\/p>\n<p><\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"columnLayout single\" data-layout=\"single\">\n<div class=\"cell normal\" data-type=\"normal\">\n<div class=\"innerCell\">\n<p>If buffered content runs try, AAMP player receives &ldquo;underflow&rdquo; events from gstreamer, and will report buffering state upstream.&nbsp;If new content is injected and playback is able to resume with short timespan, playback can resume automatically without much user impact (except for temporary freeze).<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"columnLayout single\" data-layout=\"single\">\n<div class=\"cell normal\" data-type=\"normal\">\n<div class=\"innerCell\">\n<p>If underflow state persists, with repeated underflow (or pts error) events, an automatic &#8220;internal retune&#8221; is triggered as attempt to recover.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"columnLayout single\" data-layout=\"single\">\n<div class=\"cell normal\" data-type=\"normal\">\n<div class=\"innerCell\">\n<p><strong style=\"letter-spacing: 0.0px;\">bool<\/strong><span>&nbsp;internalReTune;&nbsp;&nbsp;\/**&lt; Internal re-tune on underflows\/ pts errors*\/ default: true<\/span><\/p>\n<p><strong>int<\/strong>&nbsp;ptsErrorThreshold; \/**&lt; Max number of back-to-back PTS errors within designated time*\/ default 4<\/p>\n<p><\/p>\n<p>Independently we have &#8220;native stall detection&#8221; that can bubble up an error, with below default configuration:<\/p>\n<div class=\"code panel pdl conf-macro output-block\" data-hasbody=\"true\" data-macro-name=\"code\">\n<div class=\"codeContent panelContent pdl\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#define DEFAULT_STALL_ERROR_CODE (7600) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/**&lt; Default stall error code: 7600 *\/\n#define DEFAULT_STALL_DETECTION_TIMEOUT (10000) &nbsp;&nbsp;\/**&lt; Stall detection timeout: 10sec *\/JavaScript Player Platform handles these events by switching to an alternate CDN (when available).<\/pre>\n<\/div>\n<\/div>\n<p><span>Some additional detail, for scenarios where IP connection is lost completely:<\/span><\/p>\n<p><strong>For Linear<\/strong><\/p>\n<ul>\n<li>AAMP downloads the fragments directly, so AAMP will hit Curl error 7 (or 28, just a probability), these will be marked as failed fragments<\/li>\n<li>While playlist refresh, since it will cause curl error 7 or 28, we will set the flag mNetworkDownDetected. This will prevent sending a stall detection error to application.<\/li>\n<li>We will wait in this state until network is restored. Operator UI App&nbsp;will retrigger a playback based on persistent channel info.<\/li>\n<\/ul>\n<p><strong>For FOG-Linear (separate component involved with review buffer)<\/strong><\/p>\n<ul>\n<li>AAMP downloads the fragments through FOG. Above logic is also in-effect here, but the behavior depends on how FOG responds for playlist download when network is down<\/li>\n<\/ul>\n<p><strong>For VOD<\/strong><\/p>\n<ul>\n<li>VOD will not depend on stall detection. When network goes down, all subsequent fragment and playlist download fail<\/li>\n<li>AAMP has a logic for max segment download fail count (default:10), when thats hit it will send an error AAMP_TUNE_FRAGMENT_DOWNLOAD_FAILURE to application.<\/li>\n<li>mNetworkDownDetected will be set here also, but we have fragments available in case of VOD, hence error will be sent.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><\/body><\/html><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Default gstreamer buffering on devices that don&#8217;t support 4k content is by default: 4096k for [&hellip;]<\/p>\n","protected":false},"author":28,"featured_media":0,"parent":10015,"menu_order":24,"comment_status":"open","ping_status":"closed","template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"class_list":["post-10109","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Underflow Handling &amp; Stall Detection - RDK Documentation Portal | Documentation<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/underflow_handling__stall_detection\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Underflow Handling &amp; Stall Detection - RDK Documentation Portal | Documentation\" \/>\n<meta property=\"og:description\" content=\"Default gstreamer buffering on devices that don&#8217;t support 4k content is by default: 4096k for [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/underflow_handling__stall_detection\/\" \/>\n<meta property=\"og:site_name\" content=\"RDK Documentation Portal | Documentation\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-25T05:18:35+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/underflow_handling__stall_detection\/\",\"url\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/underflow_handling__stall_detection\/\",\"name\":\"Underflow Handling & Stall Detection - RDK Documentation Portal | Documentation\",\"isPartOf\":{\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/#website\"},\"datePublished\":\"2022-06-21T09:10:49+00:00\",\"dateModified\":\"2025-03-25T05:18:35+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/underflow_handling__stall_detection\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/underflow_handling__stall_detection\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/underflow_handling__stall_detection\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/developer.rdkcentral.com\/documentation\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Documentation\",\"item\":\"https:\/\/developer.rdkcentral.com\/documentation\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"RDK Video\",\"item\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Components\",\"item\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Advanced Adaptive Media Player (AAMP)\",\"item\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/\"},{\"@type\":\"ListItem\",\"position\":6,\"name\":\"Underflow Handling &#038; Stall Detection\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/#website\",\"url\":\"https:\/\/developer.rdkcentral.com\/documentation\/\",\"name\":\"RDK Documentation Portal | Documentation\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/developer.rdkcentral.com\/documentation\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Underflow Handling & Stall Detection - RDK Documentation Portal | Documentation","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/underflow_handling__stall_detection\/","og_locale":"en_US","og_type":"article","og_title":"Underflow Handling & Stall Detection - RDK Documentation Portal | Documentation","og_description":"Default gstreamer buffering on devices that don&#8217;t support 4k content is by default: 4096k for [&hellip;]","og_url":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/underflow_handling__stall_detection\/","og_site_name":"RDK Documentation Portal | Documentation","article_modified_time":"2025-03-25T05:18:35+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/underflow_handling__stall_detection\/","url":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/underflow_handling__stall_detection\/","name":"Underflow Handling & Stall Detection - RDK Documentation Portal | Documentation","isPartOf":{"@id":"https:\/\/developer.rdkcentral.com\/documentation\/#website"},"datePublished":"2022-06-21T09:10:49+00:00","dateModified":"2025-03-25T05:18:35+00:00","breadcrumb":{"@id":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/underflow_handling__stall_detection\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/underflow_handling__stall_detection\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/underflow_handling__stall_detection\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/developer.rdkcentral.com\/documentation\/"},{"@type":"ListItem","position":2,"name":"Documentation","item":"https:\/\/developer.rdkcentral.com\/documentation\/"},{"@type":"ListItem","position":3,"name":"RDK Video","item":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/"},{"@type":"ListItem","position":4,"name":"Components","item":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/"},{"@type":"ListItem","position":5,"name":"Advanced Adaptive Media Player (AAMP)","item":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/"},{"@type":"ListItem","position":6,"name":"Underflow Handling &#038; Stall Detection"}]},{"@type":"WebSite","@id":"https:\/\/developer.rdkcentral.com\/documentation\/#website","url":"https:\/\/developer.rdkcentral.com\/documentation\/","name":"RDK Documentation Portal | Documentation","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/developer.rdkcentral.com\/documentation\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages\/10109","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/users\/28"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/comments?post=10109"}],"version-history":[{"count":1,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages\/10109\/revisions"}],"predecessor-version":[{"id":10111,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages\/10109\/revisions\/10111"}],"up":[{"embeddable":true,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages\/10015"}],"wp:attachment":[{"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/media?parent=10109"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}