mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-04-22 04:25:01 +00:00
Plug RTP
This commit is contained in:
parent
0e34f4fbf7
commit
0d298ad577
2 changed files with 16 additions and 1 deletions
|
@ -12,7 +12,7 @@
|
|||
#include "util/net.h"
|
||||
#include "util/thread.h"
|
||||
|
||||
#define SC_DEMUXER_MAX_SINKS 2
|
||||
#define SC_DEMUXER_MAX_SINKS 3
|
||||
|
||||
struct sc_demuxer {
|
||||
sc_socket socket;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "keyboard_inject.h"
|
||||
#include "mouse_inject.h"
|
||||
#include "recorder.h"
|
||||
#include "rtp.h"
|
||||
#include "screen.h"
|
||||
#include "server.h"
|
||||
#ifdef HAVE_USB
|
||||
|
@ -42,6 +43,7 @@ struct scrcpy {
|
|||
struct sc_demuxer demuxer;
|
||||
struct sc_decoder decoder;
|
||||
struct sc_recorder recorder;
|
||||
struct sc_rtp rtp;
|
||||
#ifdef HAVE_V4L2
|
||||
struct sc_v4l2_sink v4l2_sink;
|
||||
#endif
|
||||
|
@ -283,6 +285,7 @@ scrcpy(struct scrcpy_options *options) {
|
|||
bool server_started = false;
|
||||
bool file_pusher_initialized = false;
|
||||
bool recorder_initialized = false;
|
||||
bool rtp_initialized = false;
|
||||
#ifdef HAVE_V4L2
|
||||
bool v4l2_sink_initialized = false;
|
||||
#endif
|
||||
|
@ -420,6 +423,14 @@ scrcpy(struct scrcpy_options *options) {
|
|||
sc_demuxer_add_sink(&s->demuxer, &rec->packet_sink);
|
||||
}
|
||||
|
||||
struct sc_rtp *rtp = NULL;
|
||||
if (!sc_rtp_init(&s->rtp, "rtp://127.0.0.1:1234", info->frame_size)) {
|
||||
goto end;
|
||||
}
|
||||
rtp = &s->rtp;
|
||||
rtp_initialized = true;
|
||||
sc_demuxer_add_sink(&s->demuxer, &rtp->packet_sink);
|
||||
|
||||
struct sc_controller *controller = NULL;
|
||||
struct sc_key_processor *kp = NULL;
|
||||
struct sc_mouse_processor *mp = NULL;
|
||||
|
@ -707,6 +718,10 @@ end:
|
|||
sc_controller_destroy(&s->controller);
|
||||
}
|
||||
|
||||
if (rtp_initialized) {
|
||||
sc_rtp_destroy(&s->rtp);
|
||||
}
|
||||
|
||||
if (recorder_initialized) {
|
||||
sc_recorder_destroy(&s->recorder);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue