Skip to content
This repository was archived by the owner on Jul 21, 2020. It is now read-only.

Commit 363f3a1

Browse files
committed
Merge pull request #8 from WatchBeam/cmake-fix
fixed crash after 'start encoding', few minor cleanup items
2 parents df95067 + 9122263 commit 363f3a1

File tree

3 files changed

+38
-21
lines changed

3 files changed

+38
-21
lines changed

cmake/Modules/FindFTLSDK.cmake

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ find_path(FTLSDK_INCLUDE_DIR
2626
ENV FTLPath
2727
ENV DepsPath${_lib_suffix}
2828
ENV DepsPath
29-
${ftlPath${_lib_suffix}}
30-
${ftlPath}
29+
${FTLPath${_lib_suffix}}
30+
${FTLPath}
3131
${DepsPath${_lib_suffix}}
3232
${DepsPath}
3333
${_FTL_INCLUDE_DIRS}

plugins/obs-ffmpeg/obs-ffmpeg-output.c

+35-18
Original file line numberDiff line numberDiff line change
@@ -203,25 +203,29 @@ ftl_status_t attempt_ftl_connection(struct ffmpeg_output *output, struct ffmpeg_
203203
static bool new_stream(struct ffmpeg_data *data, AVStream **stream,
204204
AVCodec **codec, enum AVCodecID id, int audio)
205205
{
206-
if (audio == 1) {
207-
*codec = avcodec_find_encoder(AV_CODEC_ID_OPUS);
208-
*stream = avformat_new_stream(data->output_audio, *codec);
209-
} else {
210-
*codec = avcodec_find_encoder(AV_CODEC_ID_VP8);
211-
*stream = avformat_new_stream(data->output_video, *codec);
206+
*stream = NULL;
207+
208+
if ((*codec = avcodec_find_encoder(id)) != NULL) {
209+
if (audio) {
210+
*stream = avformat_new_stream(data->output_audio, *codec);
211+
}
212+
else {
213+
*stream = avformat_new_stream(data->output_video, *codec);
214+
}
212215
}
216+
213217
if (!*stream) {
214218
blog(LOG_WARNING, "Couldn't create stream for encoder '%s'",
215219
avcodec_get_name(id));
216220
return false;
217221
}
218-
219-
222+
220223
if (audio == 1) {
221224
(*stream)->id = 0;
222225
} else {
223226
(*stream)->id = 1;
224227
}
228+
225229
return true;
226230
}
227231

@@ -253,7 +257,7 @@ static bool open_video_codec(struct ffmpeg_data *data)
253257
AVCodecContext *context = data->video->codec;
254258

255259
/* Hardcode in quality=realtime */
256-
// char **opts = strlist_split(data->config.video_settings, ' ', false);
260+
//char **opts = strlist_split(data->config.video_settings, ' ', false);
257261
char **opts = strlist_split("quality=realtime", ' ', false);
258262
int ret;
259263

@@ -337,7 +341,7 @@ static bool create_video_stream(struct ffmpeg_data *data)
337341
* source codec
338342
*/
339343

340-
closest_format = AV_PIX_FMT_YUV420P;
344+
closest_format = AV_PIX_FMT_YUV420P;
341345
context = data->video->codec;
342346
context->bit_rate = data->config.video_bitrate * 1000;
343347
context->width = data->config.scale_width;
@@ -374,7 +378,8 @@ static bool create_video_stream(struct ffmpeg_data *data)
374378
static bool open_audio_codec(struct ffmpeg_data *data)
375379
{
376380
AVCodecContext *context = data->audio->codec;
377-
char **opts = strlist_split(data->config.video_settings, ' ', false);
381+
//char **opts = strlist_split(data->config.video_settings, ' ', false);
382+
char **opts = strlist_split(data->config.audio_settings, ' ', false);
378383
int ret;
379384

380385
if (opts) {
@@ -567,11 +572,13 @@ static void close_video(struct ffmpeg_data *data)
567572
avcodec_close(data->video->codec);
568573
avpicture_free(&data->dst_picture);
569574

570-
// This format for some reason derefs video frame
571-
// too many times
572-
if (data->vcodec->id == AV_CODEC_ID_A64_MULTI ||
573-
data->vcodec->id == AV_CODEC_ID_A64_MULTI5)
574-
return;
575+
if (data->vcodec) {
576+
// This format for some reason derefs video frame
577+
// too many times
578+
if (data->vcodec->id == AV_CODEC_ID_A64_MULTI ||
579+
data->vcodec->id == AV_CODEC_ID_A64_MULTI5)
580+
return;
581+
}
575582

576583
av_frame_free(&data->vframe);
577584
}
@@ -670,6 +677,15 @@ static bool ffmpeg_data_init(struct ffmpeg_data *data,
670677
return false;
671678

672679
av_register_all();
680+
681+
int version = avcodec_version();
682+
683+
blog(LOG_WARNING, "FFMPEG Version: %d.%d.%d\n", (0xFF0000 & version) >> 16, (0xFF00 & version) >> 8, version & 0xFF);
684+
685+
char *s = avcodec_configuration();
686+
687+
blog(LOG_WARNING, "AV Codec configurations %s\n", s);
688+
673689
avformat_network_init();
674690

675691
is_rtmp = (astrcmpi_n(config->url, "rtmp://", 7) == 0);
@@ -696,9 +712,9 @@ static bool ffmpeg_data_init(struct ffmpeg_data *data,
696712
avformat_alloc_output_context2(&data->output_video, output_format2,
697713
NULL, NULL);
698714

699-
if (data->config.format_name) {
715+
//if (data->config.format_name) {
700716
set_encoder_ids(data);
701-
}
717+
//}
702718

703719
if (!data->output_audio) {
704720
blog(LOG_WARNING, "Couldn't create audio avformat context");
@@ -1117,6 +1133,7 @@ static int try_connect(struct ffmpeg_output *output)
11171133
const char *full_streamkey;
11181134

11191135
settings = obs_output_get_settings(output->output);
1136+
memset(&config, 0, sizeof(config));
11201137
config.ingest_location = get_string_or_null(settings, "url");
11211138
config.format_name = get_string_or_null(settings, "format_name");
11221139
config.format_mime_type = get_string_or_null(settings,

plugins/win-capture/graphics-hook/d3d9-capture.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct d3d9_data {
5353
IDirect3DSurface9 *render_targets[NUM_BUFFERS];
5454
IDirect3DQuery9 *queries[NUM_BUFFERS];
5555
struct shmem_data *shmem_info;
56-
volatile bool issued_queries[NUM_BUFFERS];
56+
volatile bool issued_queries[NUM_BUFFERS];
5757
bool texture_mapped[NUM_BUFFERS];
5858
uint32_t pitch;
5959
int cur_tex;

0 commit comments

Comments
 (0)