diff --git a/include/asterisk/file.h b/include/asterisk/file.h index 1fc496fdbee6f70d931ef76e7b0276b8546d7e9f..5b795d430d8fbf1584a171b37bb75674add5a359 100644 --- a/include/asterisk/file.h +++ b/include/asterisk/file.h @@ -66,9 +66,14 @@ int ast_stream_and_wait(struct ast_channel *chan, const char *file, const char * /*! * \brief Stops a stream + * * \param c The channel you wish to stop playback on + * * Stop playback of a stream - * \return 0 regardless + * + * \retval 0 always + * + * \note The channel does not need to be locked before calling this function. */ int ast_stopstream(struct ast_channel *c); diff --git a/main/file.c b/main/file.c index be5c019de94d252c9c081f7819995127024592b1..bbdda4c3815e6fdf30c217d76eec3ff7b745ffed 100644 --- a/main/file.c +++ b/main/file.c @@ -119,6 +119,8 @@ int ast_format_unregister(const char *name) int ast_stopstream(struct ast_channel *tmp) { + ast_channel_lock(tmp); + /* Stop a running stream if there is one */ if (tmp->stream) { ast_closestream(tmp->stream); @@ -131,6 +133,9 @@ int ast_stopstream(struct ast_channel *tmp) ast_closestream(tmp->vstream); tmp->vstream = NULL; } + + ast_channel_unlock(tmp); + return 0; }