interrupt_callback
时间: 2023-08-07 22:01:55 浏览: 161
cap_ffmpeg_impl.hpp
4星 · 用户满意度95%
interrupt_callback是一个回调函数,用于处理中断。在处理音视频流时,如果遇到网络卡顿或其他中断情况,可以通过设置interrupt_callback来中断当前操作并立即返回。具体实现方式是在libavformat/network.c中更改源码,将interrupt_callback与av_read_frame()等函数关联起来。当网络卡顿时,interrupt_callback会被定时执行,如果返回值为1,av_read_frame()就会立即返回而不再阻塞。这样可以实现在网络卡顿时及时关闭播放器。\[1\]\[2\]\[3\]
#### 引用[.reference_title]
- *1* [fmpeg 自定义IO中断 AVFormatContext::interrupt_callback ,AVIOInterruptCB具体处理方法](https://blog.csdn.net/zhuweigangzwg/article/details/37929461)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* *3* [read_thread解复用线程分析](https://blog.csdn.net/u012117034/article/details/128291397)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文