Activate user-selected audio devices

- Fix a bug where the initial audio data insertion would cause all
   audio data to unintentionally clear (mixed up < and > operators, damn
   human error)

 - Fixed a potential interdependant lock scenario with channel mutex
   locks and graphics mutex locks.  The main video thread could lock the
   graphics mutex and then while in the graphics mutex could lock the
   channels mutex.  Meanwhile in another thread, the channel mutex could
   get locked, and then the graphics mutex would get locked, causing a
   deadlock.

   The best way to deal with this is to not let mutexes lock within
   other mutexes, but sometimes it's difficult to avoid such as in the
   main video thread.

 - Audio devices should now be functional, and the devices in the audio
   settings can now be changed as desired.
This commit is contained in:
jp9000
2014-03-07 17:03:34 -07:00
parent 2c3a3f4e65
commit f2ee950746
9 changed files with 96 additions and 21 deletions

View File

@@ -727,6 +727,8 @@ void obs_set_output_source(uint32_t channel, obs_source_t source)
pthread_mutex_lock(&view->channels_mutex);
obs_source_addref(source);
prev_source = view->channels[channel];
calldata_setint(&params, "channel", channel);
@@ -738,17 +740,15 @@ void obs_set_output_source(uint32_t channel, obs_source_t source)
view->channels[channel] = source;
if (source) {
obs_source_addref(source);
pthread_mutex_unlock(&view->channels_mutex);
if (source)
obs_source_activate(source, MAIN_VIEW);
}
if (prev_source) {
obs_source_deactivate(prev_source, MAIN_VIEW);
obs_source_release(prev_source);
}
pthread_mutex_unlock(&view->channels_mutex);
}
void obs_enum_outputs(bool (*enum_proc)(void*, obs_output_t), void *param)