Don't set rtsp options unless we are using rtsp. Should prevent everyone from reporting the warning about unsupported options. Note that I removed some extra includs that have no business in zm_ffmpeg_camera.

pull/2736/head
Isaac Connor 2019-09-17 10:31:31 -04:00
parent c8934dac7f
commit 4509c6a239
1 changed files with 18 additions and 15 deletions

View File

@ -19,6 +19,7 @@
#include "zm.h"
#include "zm_signal.h"
#include "zm_utils.h"
#if HAVE_LIBAVFORMAT
@ -35,11 +36,6 @@ extern "C" {
#define AV_ERROR_MAX_STRING_SIZE 64
#endif
#ifdef SOLARIS
#include <sys/errno.h> // for ESRCH
#include <signal.h>
#include <pthread.h>
#endif
#include <string>
@ -338,16 +334,20 @@ int FfmpegCamera::OpenFfmpeg() {
// Set transport method as specified by method field, rtpUni is default
const std::string method = Method();
if ( method == "rtpMulti" ) {
ret = av_dict_set(&opts, "rtsp_transport", "udp_multicast", 0);
} else if ( method == "rtpRtsp" ) {
ret = av_dict_set(&opts, "rtsp_transport", "tcp", 0);
} else if ( method == "rtpRtspHttp" ) {
ret = av_dict_set(&opts, "rtsp_transport", "http", 0);
} else if ( method == "rtpUni" ) {
ret = av_dict_set(&opts, "rtsp_transport", "udp", 0);
} else {
Warning("Unknown method (%s)", method.c_str());
std::string protocol = method.substr(0,4);
string_toupper(protocol);
if ( protocol == "RTSP" ) {
if ( method == "rtpMulti" ) {
ret = av_dict_set(&opts, "rtsp_transport", "udp_multicast", 0);
} else if ( method == "rtpRtsp" ) {
ret = av_dict_set(&opts, "rtsp_transport", "tcp", 0);
} else if ( method == "rtpRtspHttp" ) {
ret = av_dict_set(&opts, "rtsp_transport", "http", 0);
} else if ( method == "rtpUni" ) {
ret = av_dict_set(&opts, "rtsp_transport", "udp", 0);
} else {
Warning("Unknown method (%s)", method.c_str());
}
}
// #av_dict_set(&opts, "timeout", "10000000", 0); // in microseconds.
@ -650,6 +650,9 @@ int FfmpegCamera::OpenFfmpeg() {
) {
Warning("Monitor dimensions are %dx%d but camera is sending %dx%d",
width, height, mVideoCodecContext->width, mVideoCodecContext->height);
} else {
Warning("Monitor dimensions are %dx%d and camera is sending %dx%d",
width, height, mVideoCodecContext->width, mVideoCodecContext->height);
}
mCanCapture = true;