mirror of
https://github.com/Genymobile/scrcpy.git
synced 2026-04-21 01:33:36 +00:00
Make stream push packets to sinks
Now that decoder and recorder implement the packet sink trait, make stream push packets to the sinks without depending on the concrete sink types.
This commit is contained in:
parent
8f10558ea9
commit
e1da07e9a8
7 changed files with 82 additions and 65 deletions
|
|
@ -41,8 +41,14 @@ decoder_close(struct decoder *decoder) {
|
|||
avcodec_free_context(&decoder->codec_ctx);
|
||||
}
|
||||
|
||||
bool
|
||||
static bool
|
||||
decoder_push(struct decoder *decoder, const AVPacket *packet) {
|
||||
bool is_config = packet->pts == AV_NOPTS_VALUE;
|
||||
if (is_config) {
|
||||
// nothing to do
|
||||
return true;
|
||||
}
|
||||
|
||||
int ret;
|
||||
if ((ret = avcodec_send_packet(decoder->codec_ctx, packet)) < 0) {
|
||||
LOGE("Could not send video packet: %d", ret);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue