res_stasis: Add control ref to playback and recording structs.
authorRichard Mudgett <rmudgett@digium.com>
Tue, 29 Mar 2016 18:47:08 +0000 (13:47 -0500)
committerRichard Mudgett <rmudgett@digium.com>
Wed, 30 Mar 2016 21:36:20 +0000 (16:36 -0500)
commit0ea742d33a89c8d1d3b92eceb833cbe79faab954
tree9b1f0acf578ac015ce8adc1e4e72163a96958511
parent53f63ad7704b1b1f2b1465a23f89900266fc8115
res_stasis: Add control ref to playback and recording structs.

The stasis_app_playback and stasis_app_recording structs need to have a
struct stasis_app_control ref.  Other threads can get a reference to the
playback and recording structs from their respective global container.
These other threads can then use the control pointer they contain after
the control struct has gone.

* Add control ref to stasis_app_playback and stasis_app_recording structs.

With the refs added, the control command queue can now have a circular
control reference which will cause the control struct to never get
released if the control's command queue is not flushed when the channel
leaves the Stasis application.  Also the command queue needs better
protection from adding commands if the control->is_done flag is set.

* Flush the control command queue on exit.

ASTERISK-25882 #close

Change-Id: I3cf1fb59cbe6f50f20d9e35a2c07ac07d7f4320d
include/asterisk/stasis_app.h
res/ari/resource_bridges.c
res/res_stasis.c
res/res_stasis_playback.c
res/res_stasis_recording.c
res/stasis/control.c
res/stasis/control.h