UI: Use new NVENC by default in simple output mode

If the new texture-based NVENC implementation is available, uses it by
default when a user is using simple output mode.
This commit is contained in:
jp9000 2019-02-05 18:22:40 -08:00
parent ed0c7bcd6a
commit 79613b6696

View File

@ -8,6 +8,8 @@
using namespace std; using namespace std;
extern bool EncoderAvailable(const char *encoder);
static void OBSStreamStarting(void *data, calldata_t *params) static void OBSStreamStarting(void *data, calldata_t *params)
{ {
BasicOutputHandler *output = static_cast<BasicOutputHandler*>(data); BasicOutputHandler *output = static_cast<BasicOutputHandler*>(data);
@ -302,7 +304,10 @@ void SimpleOutput::LoadRecordingPreset()
} else if (strcmp(encoder, SIMPLE_ENCODER_AMD) == 0) { } else if (strcmp(encoder, SIMPLE_ENCODER_AMD) == 0) {
LoadRecordingPreset_h264("amd_amf_h264"); LoadRecordingPreset_h264("amd_amf_h264");
} else if (strcmp(encoder, SIMPLE_ENCODER_NVENC) == 0) { } else if (strcmp(encoder, SIMPLE_ENCODER_NVENC) == 0) {
LoadRecordingPreset_h264("ffmpeg_nvenc"); const char *id = EncoderAvailable("jim_nvenc")
? "jim_nvenc"
: "ffmpeg_nvenc";
LoadRecordingPreset_h264(id);
} }
usingRecordingPreset = true; usingRecordingPreset = true;
@ -317,14 +322,22 @@ SimpleOutput::SimpleOutput(OBSBasic *main_) : BasicOutputHandler(main_)
{ {
const char *encoder = config_get_string(main->Config(), "SimpleOutput", const char *encoder = config_get_string(main->Config(), "SimpleOutput",
"StreamEncoder"); "StreamEncoder");
if (strcmp(encoder, SIMPLE_ENCODER_QSV) == 0)
if (strcmp(encoder, SIMPLE_ENCODER_QSV) == 0) {
LoadStreamingPreset_h264("obs_qsv11"); LoadStreamingPreset_h264("obs_qsv11");
else if (strcmp(encoder, SIMPLE_ENCODER_AMD) == 0)
} else if (strcmp(encoder, SIMPLE_ENCODER_AMD) == 0) {
LoadStreamingPreset_h264("amd_amf_h264"); LoadStreamingPreset_h264("amd_amf_h264");
else if (strcmp(encoder, SIMPLE_ENCODER_NVENC) == 0)
LoadStreamingPreset_h264("ffmpeg_nvenc"); } else if (strcmp(encoder, SIMPLE_ENCODER_NVENC) == 0) {
else const char *id = EncoderAvailable("jim_nvenc")
? "jim_nvenc"
: "ffmpeg_nvenc";
LoadStreamingPreset_h264(id);
} else {
LoadStreamingPreset_h264("obs_x264"); LoadStreamingPreset_h264("obs_x264");
}
if (!CreateAACEncoder(aacStreaming, aacStreamEncID, GetAudioBitrate(), if (!CreateAACEncoder(aacStreaming, aacStreamEncID, GetAudioBitrate(),
"simple_aac", 0)) "simple_aac", 0))