Skip to content

Commit

Permalink
Merge pull request #617 from stream-labs/obs_merge_30.2.3
Browse files Browse the repository at this point in the history
Improved error handling for QSV encoder
  • Loading branch information
summeroff authored Dec 11, 2024
2 parents 07e303c + e91a568 commit 7cddd55
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion libobs/obs-source-transition.c
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,7 @@ bool obs_transition_audio_render_do(obs_source_t *transition, uint64_t *ts_out,
if (!transition_valid(transition, "obs_transition_audio_render"))
return false;

blog(LOG_INFO, "[AUDIO_CANVAS] obs_transition_audio_render_do started");
//blog(LOG_INFO, "[AUDIO_CANVAS] obs_transition_audio_render_do started");
lock_transition(transition);

sources[0] = transition->transition_sources[0];
Expand Down
9 changes: 5 additions & 4 deletions plugins/obs-qsv11/QSV_Encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,17 @@ void qsv_encoder_version(unsigned short *major, unsigned short *minor)
}

qsv_t *qsv_encoder_open(qsv_param_t *pParams, enum qsv_codec codec,
bool useTexAlloc)
bool useTexAlloc, obs_encoder_t *encoder)
{
QSV_Encoder_Internal *pEncoder =
new QSV_Encoder_Internal(ver, useTexAlloc);
mfxStatus sts = pEncoder->Open(pParams, codec);
if (sts != MFX_ERR_NONE) {

#define WARN_ERR_IMPL(err, str, err_name) \
case err: \
do_log(LOG_WARNING, str " (" err_name ")"); \
#define WARN_ERR_IMPL(err, str, err_name) \
case err: \
obs_encoder_set_last_error(encoder, str " (" err_name ")"); \
do_log(LOG_WARNING, str " (" err_name ")"); \
break;
#define WARN_ERR(err, str) WARN_ERR_IMPL(err, str, #err)

Expand Down
4 changes: 3 additions & 1 deletion plugins/obs-qsv11/QSV_Encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include <obs.h>
#include "common_utils.h"

#ifdef __cplusplus
Expand Down Expand Up @@ -157,7 +158,8 @@ int qsv_param_default_preset(qsv_param_t *, const char *preset,
const char *tune);
int qsv_encoder_reconfig(qsv_t *, qsv_param_t *);
void qsv_encoder_version(unsigned short *major, unsigned short *minor);
qsv_t *qsv_encoder_open(qsv_param_t *, enum qsv_codec codec, bool useTexAlloc);
qsv_t *qsv_encoder_open(qsv_param_t *, enum qsv_codec codec, bool useTexAlloc,
obs_encoder_t *encoder);
void qsv_encoder_add_roi(qsv_t *, const struct obs_encoder_roi *roi);
void qsv_encoder_clear_roi(qsv_t *pContext);
int qsv_encoder_encode(qsv_t *, uint64_t, uint8_t *, uint8_t *, uint32_t,
Expand Down
4 changes: 2 additions & 2 deletions plugins/obs-qsv11/obs-qsv11.c
Original file line number Diff line number Diff line change
Expand Up @@ -869,8 +869,8 @@ static void *obs_qsv_create(enum qsv_codec codec, obs_data_t *settings,

if (update_settings(obsqsv, settings)) {
pthread_mutex_lock(&g_QsvLock);
obsqsv->context =
qsv_encoder_open(&obsqsv->params, codec, useTexAlloc);
obsqsv->context = qsv_encoder_open(&obsqsv->params, codec,
useTexAlloc, encoder);
pthread_mutex_unlock(&g_QsvLock);

if (obsqsv->context == NULL)
Expand Down

0 comments on commit 7cddd55

Please sign in to comment.