Audio / Video Playback
Audio / Video Playback
Interested in helping out? Check out our bugs! New to Chromium? GoodFirstBug is your friend!Filing a new bug: Template
Documentation:
Much of the documentation below is out of date and has significant gaps. For the most up to date documentation please see the README.md file in the media/ directory (which is where all the code for Chromium's media pipeline lives).
OverviewThere are several major components to Chromium's media playback implementation, here are three most folks are commonly interested in:
PipelineThe pipeline is a pull-based media playback engine that abstracts each step of media playback into (at least) 6 different filters: data source, demuxing, audio decoding, video decoding, audio rendering, and video rendering. The pipeline manages the lifetime of the renderer and exposes a thread safe interface to clients. The filters are connected together to form a filter graph.
Design goals:
- Use Chromium threading constructs such as TaskRunner
- Filters do not determine threading model
- All filter actions are asynchronous and use callbacks to signal completion
- Upstream filters are oblivious to downstream filters (i.e., DataSource is unaware of Demuxer)
- Prefer explicit types and methods over general types and methods (i.e., prefer foo->Bar() over foo->SendMessage(MSG_BAR))
- Can run inside security sandbox
- Runs on Windows, Mac and Linux on x86 and ARM
- Supports arbitrary audio/video codecs
Design non-goals:
- Dynamic loading of filters via shared libraries
- Buffer management negotiation
- Building arbitrary filter graphs
- Supporting filters beyond the scope of media playback
The original research into supporting video in Chromium started in September 2008. Before deciding to implement our own media playback engine we considered the following alternative technologies:
- DirectShow (Windows specific, cannot run inside sandbox without major hacking)
- GStreamer (Windows support questionable at the time, extra ~2MB of DLLs due to library dependencies, targets many of our non-goals)
- VLC (cannot use due to GPL)
- MPlayer (cannot use due to GPL)
- OpenMAX (complete overkill for our purposes)
- liboggplay (specific to Ogg Theora/Vorbis)
Our approach was to write our own media playback engine that was audio/video codec agnostic and focused on playback. Using FFmpeg avoids both the use of proprietary/commercial codecs and allows Chromium's media engine to support a wide variety of formats depending on FFmpeg's build configuration.
![]() As previously mentioned, the pipeline is completely pull-based and relies on the sound card to drive playback. As the sound card requests additional data, the audio renderer requests decoded audio data from the audio decoder, which requests encoded buffers from the demuxer, which reads from the data source, and so on. As decoded audio data data is fed into the sound card the pipeline's global clock is updated. The video renderer polls the global clock upon each vsync to determine when to request decoded frames from the video decoder and when to render new frames to the video display. In the absence of a sound card or an audio track, the system clock is used to drive video decoding and rendering. Relevant source code is in the media directory.
The pipeline uses a state machine to handle playback and events such as pausing, seeking, and stopping. A state transition typically consists of notifying all filters of the event and waiting for completion callbacks before completing the transition (diagram from pipeline_impl.h):
// [ *Created ] [ Any State ] The pull-based design allows pause to be implemented by setting the playback rate to zero, causing the audio and video renderers to stop requesting data from upstream filters. Without any pending requests the entire pipeline enters an implicit paused state.
IntegrationThe following diagram shows the current integration of the media playback pipeline into WebKit and Chromium browser; this is slightly out of date, but the gist remains the same.
|
Audio / Video Playback的更多相关文章
- [jPlayer] HTML5 Audio & Video for jQuery
---------------------------------------------------------------------------------------------------- ...
- stagefright框架(一)Video Playback的流程
在Android上,預設的多媒體框架(multimedia framework)是OpenCORE. OpenCORE的優點是兼顧了跨平台的移植性,而且已經過多方驗證,所以相對來說較為穩定:但是其缺點 ...
- 从Chrome源码看audio/video流媒体实现二(转)
第一篇主要介绍了Chrome加载音视频的缓冲控制机制和编解码基础,本篇将比较深入地介绍解码播放的过程.以Chromium 69版本做研究. 由于Chromium默认不能播放Mp4,所以需要需要改一下源 ...
- HTML5 Audio/Video 标签,属性,方法,事件汇总
HTML5 Audio/Video 标签,属性,方法,事件汇总 (转) 2011-06-28 13:16:48 <audio> 标签属性:src:音乐的URLpreload:预加载au ...
- Capturing Audio & Video in HTML5
使用HTML5抓取 Audio & Video 原文地址: http://www.html5rocks.com/en/tutorials/getusermedia/intro/ 本地化的文章: ...
- [转载]HTML5 Audio/Video 标签,属性,方法,事件汇总
<audio> 标签属性: src:音乐的URL preload:预加载 autoplay:自动播放 loop:循环播放 controls:浏览器自带的控制条 <audio id=& ...
- 如何让windows版Safari支持H5 audio/video?
今天在windows版Safari上看效果的时候惊奇地发现它竟然不支持HTML5的audio/video, 这样的话就无法复现不少ios上出现的问题. 在同事提醒下, 发现Safari HTML5 A ...
- HTML 5 Audio/Video DOM buffered 属性
1.实例1获取视频第一段缓冲范围部分,以秒计: myVid=document.getElementById("video1"); alert("Start: " ...
- js 多媒体audio video
本文主要简单的介绍一下audio 和 video两个标签的用法 <audio src="music.mp3"></audio> <video src= ...
随机推荐
- angular4(1)angular脚手架
angular2之后有了类似于vue-cli的脚手架工具,很方便的帮助我们搭建项目: 1.安装angular命令行工具:npm install @angular/cli -g 2.检测angular- ...
- Java中异常处理之try和catch代码块的使用
转自:https://www.jb51.net/article/72901.htm Java try和catch的使用 尽管由Java运行时系统提供的默认异常处理程序对于调试是很有用的,但通常你希望自 ...
- 关于linux下QIODevice类进行读取的几个方法的理解
Qt中对读写设备的支持力度很大,其都继承与QIODevice类,其中有几个方法是非常值得注意的,不管是在用原始的serial port进行通信还是使用网络的TCP/IP 或者UDP或者HTTP等协议时 ...
- [AH2017/HNOI2017] 礼物 解题报告 (FFT)
题目链接: https://www.luogu.org/problemnew/show/P3723 题目: 我的室友最近喜欢上了一个可爱的小女生.马上就要到她的生日了,他决定买一对情侣手环,一个留给自 ...
- sql server 查询某个表一直显示"正在执行中..."的问题
问题描述:只是单纯的执行了"select count(*) from 某表":数据表中只有一两条数据,能查询其他表,唯独这个表不能进行任何操作: 经百度搜索实验,发现应该是某个进程 ...
- IEEE Access的模板的问题
这个模板果然问题还是有一些,比如caption换行得自己改class文件.首先感谢一下CSDN的一位网友的经验https://blog.csdn.net/baidu_21381705/article/ ...
- (转载) android快速搭建项目积累
android快速搭建项目积累 2016-04-05 20:07 519人阅读 评论(0) 收藏 举报 分类: android优化(8) Rx技术(5) 版权声明:本文为博主原创文章,未经博主 ...
- 使用yum配置lnmp环境(CentOS7.6)
一.安装版本详情 Server: MariaDB Server version: 5.5.60-MariaDB MariaDB Server [root@ln-125 ~]# cat /etc/red ...
- /application/nginx/sbin/nginx -h
[root@web03 ~]# /application/nginx/sbin/nginx -h nginx version: nginx/1.6.3Usage: nginx [-?hvVtq] [- ...
- 洛谷 P2738 [USACO4.1]篱笆回路Fence Loops
P2738 [USACO4.1]篱笆回路Fence Loops 题目描述 农夫布朗的牧场上的篱笆已经失去控制了.它们分成了1~200英尺长的线段.只有在线段的端点处才能连接两个线段,有时给定的一个端点 ...

