Skip to content

Commit

Permalink
add gst udp vs fd as option
Browse files Browse the repository at this point in the history
  • Loading branch information
Consti10 committed Apr 9, 2024
1 parent 5331490 commit 3c7b0b0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 14 additions & 3 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ long long bw_stats[10];
int video_zpos = 1;
int develop_rendering_mode=0;
bool decode_h265=false;
int gst_udp_port=-1;
struct TSAccumulator m_decoding_latency;
// NOTE: Does not track latency to end completely
struct TSAccumulator m_decode_and_handover_display_latency;
Expand Down Expand Up @@ -894,7 +895,8 @@ int read_rtp_stream(int port, MppPacket *packet, uint8_t* nal_buffer) {


void read_gstreamerpipe_stream(MppPacket *packet){
GstRtpReceiver receiver{5600,decode_h265 ? 1 : 0};
assert(gst_udp_port!=-1);
GstRtpReceiver receiver{gst_udp_port,decode_h265 ? 1 : 0};
int decoder_stalled_count=0;
auto cb=[&packet,&decoder_stalled_count](std::shared_ptr<std::vector<uint8_t>> frame){
//printf("Got data \n");
Expand Down Expand Up @@ -1031,6 +1033,8 @@ void printHelp() {
"\n"
" --h265 - Decode h265. H264 is default. \n"
"\n"
" --gst-udp-port - use internal gst for decoding, specifies the udp port for rtp in. Otherwise, fd needs to be provided. \n"
"\n"
" --rmode - different rendering modes for development \n"
"\n", __DATE__
);
Expand Down Expand Up @@ -1165,6 +1169,10 @@ int main(int argc, char **argv)
decode_h265=true;
continue;
}
__OnArgument("--gst-udp-port") {
gst_udp_port=atoi(__ArgValue);
continue;
}
__OnArgument("--rmode") {
const char* mode = __ArgValue;
develop_rendering_mode= atoi((char*)mode);
Expand Down Expand Up @@ -1253,8 +1261,11 @@ int main(int argc, char **argv)
////////////////////////////////////////////// MAIN LOOP

//read_rtp_stream(listen_port, packet, nal_buffer);
//read_filesrc_stream((void**)packet);
read_gstreamerpipe_stream((void**)packet);
if(gst_udp_port==-1){
read_filesrc_stream((void**)packet);
}else{
read_gstreamerpipe_stream((void**)packet);
}

////////////////////////////////////////////// MPI CLEANUP

Expand Down
2 changes: 1 addition & 1 deletion run_help2.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#b!in/bash

./build/fpvue --rmode 5
./build/fpvue --gst-udp-port 5600 --rmode 5

0 comments on commit 3c7b0b0

Please sign in to comment.