
{"id":10069,"date":"2022-06-21T09:10:45","date_gmt":"2022-06-21T09:10:45","guid":{"rendered":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/documentation\/rdk_video_documentation\/components\/open-sourced_components\/advanced_adaptive_media_player_aamp\/aamp_gstreamer_integration_overview\/"},"modified":"2025-03-25T05:18:35","modified_gmt":"2025-03-25T05:18:35","slug":"aamp_gstreamer_integration_overview","status":"publish","type":"page","link":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/aamp_gstreamer_integration_overview\/","title":{"rendered":"AAMP Gstreamer Integration Overview"},"content":{"rendered":"<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\">\n <html><body><div class=\"toc-macro client-side-toc-macro  conf-macro output-block\" data-headerelements=\"H1\" data-hasbody=\"false\" data-macro-name=\"toc\"> <\/div><h2 class=\"wp-main-header wp-block-heading\">GStreamer Abstraction Layer &amp; Plugin<\/h2><p>AAMP has two modes of operation &#8211; gstreamer player (when JS\/Native API&#8217;s are used by the application) and gstreamer element (when application manages playbin as in the case of html5 video playback)<\/p><h3 id=\"AAMPGstreamerIntegrationOverview-AAMPasGstreamerplayer\">AAMP as Gstreamer player<\/h3><p>In this mode of operation, AAMP manages the gstreamer pipeline. AAMP creates one playbin for each stream ( Audio or Video) and adds these playbins to pipeline. AAMP manages the pipeline state as well as injects data to the playbins through gstreamer appsrc element. AAMP sets caps of appsrc src pads based on the format of injected data.&nbsp;Buffers and events are sent to gstreamer using these appsrc objects.<\/p><h3 id=\"AAMPGstreamerIntegrationOverview-AAMPasGstreamerelement\">AAMP as Gstreamer element<\/h3><p>In this mode of operation, AAMP is a gstreamer element. Usually, application manages the lifecycle of the playbin which has aamp as one element. There is a dummy element aampsrc to handle protocol &#8220;aamp:\/\/&#8221; and &#8220;aamps:\/\/&#8221; which is replaced to http internally. aamp gstreamer element manages state of AAMP engine as well as gets media data and injects it to next element. aamp gstreamer element exposes dynamic pads which have caps corresponding to the format of injected data on that srcpad.&nbsp;<\/p><p>AAMP provides four gstreamer plugins.<\/p><ol><li>aampsrc &#8211; Used as a dummy protocol handler to handle aamp:\/\/ or aamps:\/\/ URL prefix. Used only on HTML5 video playback.<\/li><li>aamp &#8211; Manages an AAMP instance lets playback of DASH and HLS streams.&nbsp;Used only on HTML5 video playback. Instead of using&nbsp;AAMPGstPlayer, this plugin provides buffers on src pads, which is used by playbin to connect required demux\/decoder element.<\/li><li>aampwidevinedecryptor: Decrypt Widevine encrypted samples<\/li><li>aampplayreadydecryptor: Decrypt PlayReady encrypted samples<\/li><\/ol><h2 class=\"wp-main-header wp-block-heading\">Software demux vs hardware demux<\/h2><p>For HLS, AAMP uses software demux which is a part of AAMP code by default. If codec info is not in the manifest, AAMP does not demux the TS fragments, which causes h\/w demux gstreamer element of the platform to be used by playbin to demux the TS fragments. In summary, AAMP outputs elementary streams on using s\/w demux, else output mpeg TS buffers which results in hardware demux to be used.<\/p><h2 class=\"wp-main-header wp-block-heading\">HLS on RPI<\/h2><h3 class=\"wp-sub-header\">HLS on RPI (UVE and S\/W Demux)<\/h3><p>AAMP manages the pipeline. For audio and video there are separate playbins. AAMP provides audio\/video elementary stream to the playbins using appsrc. Playbin connects platform decoder and sink elements using the capability of the&nbsp; appsrc src pads.<\/p><h3 class=\"wp-sub-header\">HLS on RPI (UVE, H\/W Demux)<\/h3><p>AAMP manages the pipeline. AAMP provides&nbsp; TS&nbsp; to the playbins using appsrc. Playbin connects platform ts-demux, decoder and sink elements.<\/p><h3 class=\"wp-sub-header\">Pipeline graph of HLS playback :<\/h3><p><span class=\"confluence-embedded-file-wrapper confluence-embedded-manual-size\"><img decoding=\"async\" src=\"\/wp-content\/uploads\/sites\/16\/2023\/09\/hls_playback.png\"><\/span><\/p><p><br><\/p><h2 class=\"wp-main-header wp-block-heading\">DASH Widevine on RPI(UVE)<\/h2><p>AAMP manages the pipeline. For audio and video there are separate playbins. AAMP provides audio\/video fragmented mp4 buffers to the playbins using appsrc. Playbin connects qtdemux, platform decoder and sink elements using the capability of the src pads.<\/p><h3 id=\"AAMPGstreamerIntegrationOverview-QtdemuxPatches\">Qtdemux Patches<\/h3><p>For DASH streams, AAMP downloads and injects ISO-BMFF fragments to gstreamer pipeline. Demuxing is done by opensource qtdemux gstreamer plugin. To achieve PTS re-stamping to achieve desired rate\/ continuity across period boundaries, AAMP has added custom patches to qtdemux gstreamer plugin. These patches support custom events from AAMP.<\/p><h4 id=\"AAMPGstreamerIntegrationOverview-0009-qtdemux-aamp-tm.patch\">0009-qtdemux-aamp-tm.patch<\/h4><p>This patch adds support for PTS restamping of outgoing buffers from qtdemux based on&nbsp; a custom event&nbsp;<strong>aamp_override<\/strong>. App can override the base PTS which &nbsp;is to be used as base for restamping using property&nbsp;&#8220;basePTS&#8221;. If it is not proved, PTS of first fragment will be used as base PTS.&nbsp;<\/p><p><span>gst_qtdemux_decorate_and_push_buffer is the function in which qtdemux pushes the buffers to srcpad.&nbsp;If override is enabled by the event,&nbsp;<\/span>the patch re-stamps PTS of ES packets based on the rate and basePTS.<\/p><h4 id=\"AAMPGstreamerIntegrationOverview-0021-qtdemux-aamp-tm-multiperiod.patch\"><span>0021-qtdemux-aamp-tm-multiperiod.patch<\/span><\/h4><p>On period transition during trickmode, PTS of the new fragment changes. To ensure smooth trickplay experience, PTS restamping should be continuous. This patch ensures this using&nbsp;<strong>aamp-tm-disc<\/strong><span>&nbsp;<\/span>event. Fragments after this event has PTS very different from previous fragments. So base PTS has to be recalculated to have continuous trick play experience at this point. PTS offset is calculated by adding last restamped PTS prior to the event and expected delay between Iframes. Base PTS is reset. PTS offset is added to the recalculated PTS on next fragments.&nbsp;<\/p><h3 id=\"AAMPGstreamerIntegrationOverview-Decryptorgstreamerelements\">Decryptor gstreamer elements<\/h3><p>If content is encrypted with Widevine or Playready DRM, aamp decryptor elements )aampplayreadydecryptor or aampwidevinedecryptor) are automatically plugged in after qtdemux by playbin. These elements decrypt samples using opencdm interface.<\/p><h3 id=\"AAMPGstreamerIntegrationOverview-PipelinegraphofDASHstream:\">Pipeline graph of DASH stream:<\/h3><p><span class=\"confluence-embedded-file-wrapper confluence-embedded-manual-size\"><img decoding=\"async\" src=\"\/wp-content\/uploads\/sites\/16\/2023\/09\/aamp-mpegdash.png\"><\/span><\/p><h2 class=\"wp-main-header wp-block-heading\">HTML5 Video Tag based playback on Broadcom Device<\/h2><p>Here Webkit manages the pipeline. aampsrc is a dummy gstreamer source just to handle aamp:\/\/ protocol. aamp element fetches manifets\/playlists and fragments, demuxes TS fragment in case of HLS, injects buffers to the downstream element using srcpads. RDK WPE uses Westeros sink gstreamer element as video sink.<\/p><h2 class=\"wp-main-header wp-block-heading\">Progressive Support in Aamp<\/h2><p>As the engine behind Media Player component, AAMP video engine recently started supporting&nbsp; playback of streaming audio\/video in progressive format (raw mp4 or mp3 downloads) including mp3 streaming music.<\/p><p>In order to support progressive playback, aamp<span>&nbsp;<\/span><strong>by default<\/strong><span>&nbsp;<\/span>uses souphttpsrc as the source element instead of appsrc which is used for adaptive streams.Aamp decides from the url extension that the stream is progressive.Once this is confirmed, aamp would set the url to uri property of playbin.Aamp would then take its natural course and manage the pipeline.<\/p><p><span>Aamp can however choose appsrc over souphttpsrc by toggling a runtime configuration switch termed as &#8220;useAppSrcForProgressivePlayback&#8221;. This switch gets enabled when the keyword &#8220;appSrcForProgressivePlayback&#8221; is added in aamp.cfg of the box.<\/span><\/p><p>When &#8220;<span>appSrcForProgressivePlayback<\/span>&#8221; is enabled in aamp.cfg, aamp will choose appsrc as the source element and complete its pipeline.<\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>GStreamer Abstraction Layer &amp; Plugin AAMP has two modes of operation &#8211; gstreamer player (when [&hellip;]<\/p>\n","protected":false},"author":28,"featured_media":0,"parent":10015,"menu_order":14,"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-10069","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>AAMP Gstreamer Integration Overview - 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\/aamp_gstreamer_integration_overview\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"AAMP Gstreamer Integration Overview - RDK Documentation Portal | Documentation\" \/>\n<meta property=\"og:description\" content=\"GStreamer Abstraction Layer &amp; Plugin AAMP has two modes of operation &#8211; gstreamer player (when [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/aamp_gstreamer_integration_overview\/\" \/>\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=\"5 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\/aamp_gstreamer_integration_overview\/\",\"url\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/aamp_gstreamer_integration_overview\/\",\"name\":\"AAMP Gstreamer Integration Overview - RDK Documentation Portal | Documentation\",\"isPartOf\":{\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/#website\"},\"datePublished\":\"2022-06-21T09:10:45+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\/aamp_gstreamer_integration_overview\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/aamp_gstreamer_integration_overview\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/aamp_gstreamer_integration_overview\/#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\":\"AAMP Gstreamer Integration Overview\"}]},{\"@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":"AAMP Gstreamer Integration Overview - 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\/aamp_gstreamer_integration_overview\/","og_locale":"en_US","og_type":"article","og_title":"AAMP Gstreamer Integration Overview - RDK Documentation Portal | Documentation","og_description":"GStreamer Abstraction Layer &amp; Plugin AAMP has two modes of operation &#8211; gstreamer player (when [&hellip;]","og_url":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/aamp_gstreamer_integration_overview\/","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":"5 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\/aamp_gstreamer_integration_overview\/","url":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/aamp_gstreamer_integration_overview\/","name":"AAMP Gstreamer Integration Overview - RDK Documentation Portal | Documentation","isPartOf":{"@id":"https:\/\/developer.rdkcentral.com\/documentation\/#website"},"datePublished":"2022-06-21T09:10:45+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\/aamp_gstreamer_integration_overview\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/aamp_gstreamer_integration_overview\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/advanced_adaptive_media_player_aamp\/aamp_gstreamer_integration_overview\/#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":"AAMP Gstreamer Integration Overview"}]},{"@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\/10069","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=10069"}],"version-history":[{"count":1,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages\/10069\/revisions"}],"predecessor-version":[{"id":10072,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages\/10069\/revisions\/10072"}],"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=10069"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}