语言

MediaCodec.ReleaseOutputBuffer 方法

定义

重载

名称 说明
ReleaseOutputBuffer(Int32, Int64)

如果使用缓冲区完成此操作,请使用此调用更新其图面时间戳,并将其返回到编解码器以在输出图面上呈现它。

ReleaseOutputBuffer(Int32, Boolean)

如果使用缓冲区完成此操作,请使用此调用将缓冲区返回到编解码器或将其呈现在输出图面上。

ReleaseOutputBuffer(Int32, Int64)

如果使用缓冲区完成此操作,请使用此调用更新其图面时间戳,并将其返回到编解码器以在输出图面上呈现它。

[Android.Runtime.Register("releaseOutputBuffer", "(IJ)V", "")]
public void ReleaseOutputBuffer(int index, long renderTimestampNs);
[<Android.Runtime.Register("releaseOutputBuffer", "(IJ)V", "")>]
member this.ReleaseOutputBuffer : int * int64 -> unit

参数

index
Int32

以前从调用 #dequeueOutputBuffer返回的客户端拥有的输出缓冲区的索引。

renderTimestampNs
Int64

发送到Surface时要与此缓冲区关联的时间戳。

特性

例外

如果不是处于“正在执行”状态,则为

编解码器错误时。

注解

如果使用缓冲区完成此操作,请使用此调用更新其图面时间戳,并将其返回到编解码器以在输出图面上呈现它。 如果在配置此视频编解码器时未指定输出图面,则此调用只会将缓冲区返回到编解码器。

时间戳可能具有特殊含义,具体取决于目标图面。

<表>tr th SurfaceView specifics</th></tr><tr><td> If you render your buffer on aandroid.view.SurfaceView, you can use the timestamp to render the buffer at a specific time (at the VSYNC at or after the buffer timestamp) .>><< 若要执行此操作,时间戳需要 合理接近 当前 System#nanoTime。 目前,此值设置为一(1)秒内。 一些说明:

< >在><时间戳传递且缓冲区不再由android.view.Surface该缓冲区使用之前,缓冲区将不会返回到编解码器。 <li>缓冲区按顺序处理,因此可以阻止后续缓冲区显示在该 android.view.Surface位置上。 如果要对用户操作做出反应,例如停止视频或查找,这一点非常重要。 <如果将>多个缓冲区发送到要以同一 VSYNC 呈现的 android.view.Surface 缓冲区,则显示最后一个缓冲区,另一个缓冲区将被删除。 <li>如果时间戳 不 “合理接近”当前系统时间, android.view.Surface 则忽略时间戳,并在最早可行时间显示缓冲区。 在此模式下,它不会删除帧。 <li>为了获得最佳性能和质量,在所需呈现时间之前大约是两个 VSYNC 的时间时调用此方法。 对于 60Hz 显示器,这大约为 33 毫秒。 </ul></td></tr></table>

将输出缓冲区释放到编解码器后,除非稍后通过#getOutputBuffer#dequeueOutputBuffer响应返回值或Callback#onOutputBufferAvailable回调来检索它,否则不得使用它。

Java文档android.media.MediaCodec.releaseOutputBuffer(int, long)。

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于

ReleaseOutputBuffer(Int32, Boolean)

如果使用缓冲区完成此操作,请使用此调用将缓冲区返回到编解码器或将其呈现在输出图面上。

[Android.Runtime.Register("releaseOutputBuffer", "(IZ)V", "")]
public void ReleaseOutputBuffer(int index, bool render);
[<Android.Runtime.Register("releaseOutputBuffer", "(IZ)V", "")>]
member this.ReleaseOutputBuffer : int * bool -> unit

参数

index
Int32

以前从调用 #dequeueOutputBuffer返回的客户端拥有的输出缓冲区的索引。

render
Boolean

如果在配置编解码器时指定了有效的图面,则 true 会将此输出缓冲区传递到图面。

特性

例外

如果不是处于“正在执行”状态,则为

编解码器错误时。

注解

如果使用缓冲区完成此操作,请使用此调用将缓冲区返回到编解码器或将其呈现在输出图面上。 如果使用输出图面配置编解码器,则设置为rendertrue首先将缓冲区发送到该输出图面。 在不再使用/显示缓冲区后,图面会将缓冲区释放回编解码器。

将输出缓冲区释放到编解码器后,除非稍后通过#getOutputBuffer#dequeueOutputBuffer响应返回值或Callback#onOutputBufferAvailable回调来检索它,否则不得使用它。

Java文档android.media.MediaCodec.releaseOutputBuffer(int, boolean)。

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于