Video RXTX: hot-fixed locking

This commit is contained in:
Martin Pulec
2015-09-27 18:14:14 +02:00
parent 8d2b415029
commit 536bae428d
3 changed files with 18 additions and 9 deletions

View File

@@ -222,9 +222,7 @@ void *video_rxtx::sender_loop() {
video_export(m_video_exporter, tx_frame.get());
if (!m_paused) {
send_frame(tx_frame);
}
send_frame(tx_frame);
}
exit:

View File

@@ -128,13 +128,19 @@ struct response *rtp_video_rxtx::process_message(struct msg_sender *msg)
}
break;
case SENDER_MSG_PAUSE:
log_msg(LOG_LEVEL_ERROR, "[control] Paused.\n");
m_paused = true;
break;
{
lock_guard<mutex> lock(m_network_devices_lock);
log_msg(LOG_LEVEL_ERROR, "[control] Paused.\n");
m_paused = true;
break;
}
case SENDER_MSG_PLAY:
log_msg(LOG_LEVEL_ERROR, "[control] Playing again.\n");
m_paused = false;
break;
{
lock_guard<mutex> lock(m_network_devices_lock);
log_msg(LOG_LEVEL_ERROR, "[control] Playing again.\n");
m_paused = false;
break;
}
case SENDER_MSG_CHANGE_FEC:
{
delete m_fec_state;

View File

@@ -151,6 +151,10 @@ void ultragrid_rtp_video_rxtx::send_frame_async(shared_ptr<video_frame> tx_frame
int buffer_id = tx_get_buffer_id(m_tx);
if (m_paused) {
goto after_send;
}
if (m_connections_count == 1) { /* normal case - only one connection */
tx_send(m_tx, tx_frame.get(),
m_network_devices[0]);
@@ -183,6 +187,7 @@ void ultragrid_rtp_video_rxtx::send_frame_async(shared_ptr<video_frame> tx_frame
rtp_recv_r(m_network_devices[0], &timeout, ts);
}
after_send:
m_async_sending_lock.lock();
m_async_sending = false;
m_async_sending_lock.unlock();