Fix rtsp sink bug
This commit is contained in:
parent
67f4d44aeb
commit
f0d8a7b18b
@ -2,7 +2,7 @@
|
|||||||
"MUXER_OUTPUT_HEIGHT": 1080,
|
"MUXER_OUTPUT_HEIGHT": 1080,
|
||||||
"MUXER_OUTPUT_WIDTH": 1920,
|
"MUXER_OUTPUT_WIDTH": 1920,
|
||||||
"output_video_path": "test.mkv",
|
"output_video_path": "test.mkv",
|
||||||
"display_output": 2,
|
"display_output": 3,
|
||||||
"codec_rtsp_out": "H264",
|
"codec_rtsp_out": "H264",
|
||||||
"mount_address": "/rtsp-output",
|
"mount_address": "/rtsp-output",
|
||||||
"udp_buffer_size": 524288,
|
"udp_buffer_size": 524288,
|
||||||
|
|||||||
@ -12,6 +12,7 @@ SinkManager::SinkManager() {
|
|||||||
i >> j;
|
i >> j;
|
||||||
j.at("output_video_path").get_to(output_video_path);
|
j.at("output_video_path").get_to(output_video_path);
|
||||||
j.at("display_output").get_to(display_output);
|
j.at("display_output").get_to(display_output);
|
||||||
|
j.at("codec_rtsp_out").get_to(codec_rtsp_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SinkManager::create_sink(cudaDeviceProp prop) {
|
bool SinkManager::create_sink(cudaDeviceProp prop) {
|
||||||
@ -54,10 +55,10 @@ bool SinkManager::create_sink(cudaDeviceProp prop) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make the encoder
|
// Make the encoder
|
||||||
if (!strcmp(codec.c_str(), "H264")) {
|
if (!strcmp(codec_rtsp_out.c_str(), "H264")) {
|
||||||
encoder = gst_element_factory_make("nvv4l2h264enc", "encoder");
|
encoder = gst_element_factory_make("nvv4l2h264enc", "encoder");
|
||||||
g_printerr("Creating H264 Encoder.\n");
|
g_printerr("Creating H264 Encoder.\n");
|
||||||
} else if (!strcmp(codec.c_str(), "H265")) {
|
} else if (!strcmp(codec_rtsp_out.c_str(), "H265")) {
|
||||||
encoder = gst_element_factory_make("nvv4l2h265enc", "encoder");
|
encoder = gst_element_factory_make("nvv4l2h265enc", "encoder");
|
||||||
g_printerr("Creating H265 Encoder.\n");
|
g_printerr("Creating H265 Encoder.\n");
|
||||||
} else {
|
} else {
|
||||||
@ -73,10 +74,10 @@ bool SinkManager::create_sink(cudaDeviceProp prop) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make the payload-encode video into RTP packets
|
// Make the payload-encode video into RTP packets
|
||||||
if (!strcmp(codec.c_str(), "H264")) {
|
if (!strcmp(codec_rtsp_out.c_str(), "H264")) {
|
||||||
rtppay = gst_element_factory_make("rtph264pay", "rtppay");
|
rtppay = gst_element_factory_make("rtph264pay", "rtppay");
|
||||||
g_printerr("Creating H264 rtppay.\n");
|
g_printerr("Creating H264 rtppay.\n");
|
||||||
} else if (!strcmp(codec.c_str(), "H265")) {
|
} else if (!strcmp(codec_rtsp_out.c_str(), "H265")) {
|
||||||
rtppay = gst_element_factory_make("rtph265pay", "rtppay");
|
rtppay = gst_element_factory_make("rtph265pay", "rtppay");
|
||||||
g_printerr("Creating H265 rtppay.\n");
|
g_printerr("Creating H265 rtppay.\n");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,10 +9,12 @@
|
|||||||
|
|
||||||
class SinkManager {
|
class SinkManager {
|
||||||
private:
|
private:
|
||||||
|
std::string codec_rtsp_out;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GstElement *sink = NULL, *nvvidconv_postosd = NULL, *caps = NULL,
|
GstElement *sink = NULL, *nvvidconv_postosd = NULL, *caps = NULL,
|
||||||
*encoder = NULL, *rtppay = NULL;
|
*encoder = NULL, *rtppay = NULL;
|
||||||
std::string codec, host, output_sink, output_video_path;
|
std::string host, output_sink, output_video_path;
|
||||||
int display_output = 1, bitrate;
|
int display_output = 1, bitrate;
|
||||||
guint updsink_port_num;
|
guint updsink_port_num;
|
||||||
SinkManager();
|
SinkManager();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user