属性:
max-lateness
“max-lateness” gint64Flags :Read / Write
Default : -1 (表示无限大,只要开启sync模式就不会被drop)
单位 : 纳秒
简介:丢帧容忍值
解析:时钟同步功能相关,当到达的 GstBuffer 中的 pts + duration 小于 当前时钟的值时,说明这个 GstBuffer 到达 Sink 的时间太晚了,理论上会被丢弃而不会进入 render 函数处理 。但是GstBaseSink 提供一个容忍时间,如果 pts + duration 距离 当前时间的差值 在这个容忍时间内,则说明当前 GstBuffer 还是 “可以抢救一下的” , 因此会被放行进入 render 虚函数。
如上图,当前时钟时间减去 max_lateness 的红色区域长度 如果过能够覆盖到 GstBuffer.pts ~ GstBuffer.pts+GstBuffer.duration 的绿色区域,则说明 GstBuffer 落在了容忍区间内,因此是可以破例 render 而不被 drop 的。
此属性必须和 sync = true 一起使用。
提前到达的 GstBuffer 不会被 drop。
ts-offset
“ts-offset” gint64Flags : Read / Wirte
Default :0
单位:纳秒
简介:render时机动态补偿
解析:这个值同样用于同步场景,但是不是控制是否 drop 的,而是控制 render 的时机的,正值代表滞后于预先约定的时间点调用 render,负值表示提前于预先约定的时间点调用 render。相当于是一个手动的 render 补偿。预先约定的时间为 GstBuffer 中的 pts 。
sync
“sync” gbooleanFlags : Read / Write
Default :True
简介:是否开启时钟同步
解析:此属性控制是否开启时钟同步,如果开启,则收到的GstBuffer如果不满足时钟同步条件则会被 drop 而失去 render 的机会。具体的同步条件由多种条件决定,上面的max_lateness就是其中之一。
GstBaseSink 虚函数原语及 default 实现:
get_times
get_times (GstBaseSink * sink, GstBuffer * buffer, GstClockTime * start, GstClockTime * end)Called to get the start and end times for synchronising the passed buffer to the clock
Parameters:
sink
– 当前element实例
buffer
– 待处理的 GstBuffer
start
– 输出,根据 GstBuffer 的 pts 和 duration 计算出来的时间区间的开始时刻
end
– 输出,根据 GstBuffer 的 pts 和 duration 计算出来的时间区间的结束时刻
原语:根据GstBuffer的信息,计算出当前GstBuffer落于哪一个时间段内,起止时间为 start 和 end。
default实现:区间为 [ GstBuffer.pts , GstBuffer.pts + GstBuffer.duration ]