fix(decklink-bridge): avoid redundant fc_writer_open calls in reopen_slot
This commit is contained in:
parent
58c058b10c
commit
d957ce74ae
1 changed files with 12 additions and 0 deletions
|
|
@ -360,10 +360,22 @@ private:
|
|||
/* Serialize with frame writes and any concurrent reopen_slot() so we
|
||||
* never double-free fc_writer or write to a half-closed one. */
|
||||
pthread_mutex_lock(&m_ds->fc_lock);
|
||||
|
||||
// If already open with same format, do nothing.
|
||||
if (m_ds->fc_writer) {
|
||||
fc_hdr_t *h = (fc_hdr_t *)m_ds->fc_writer->base;
|
||||
if (h->width == (uint32_t)m_ds->width &&
|
||||
h->height == (uint32_t)m_ds->height &&
|
||||
h->fps_num == (uint32_t)m_ds->fps_num &&
|
||||
h->fps_den == (uint32_t)m_ds->fps_den)
|
||||
{
|
||||
pthread_mutex_unlock(&m_ds->fc_lock);
|
||||
return;
|
||||
}
|
||||
fc_writer_close(m_ds->fc_writer);
|
||||
m_ds->fc_writer = nullptr;
|
||||
}
|
||||
|
||||
if (m_ds->width > 0 && m_ds->height > 0 && m_ds->fps_num > 0) {
|
||||
m_ds->fc_writer = fc_writer_open(
|
||||
m_ds->fc_url.c_str(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue