summaryrefslogtreecommitdiff
path: root/pjmedia/src/pjmedia-videodev
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2012-02-03 07:56:12 +0000
committerLiong Sauw Ming <ming@teluu.com>2012-02-03 07:56:12 +0000
commitbaf4adfa3f4c6373b2d31b6af4dbd36d1a2d0c7e (patch)
tree382091969a1eac3d8b976c4fa27b493a83e556e9 /pjmedia/src/pjmedia-videodev
parent1aba6743d4198f881c9972e07c9162fe16779125 (diff)
Re #1446 (misc fix): Fix crash problem due to uninitialized list when SDL creation failed
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3949 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia/src/pjmedia-videodev')
-rw-r--r--pjmedia/src/pjmedia-videodev/sdl_dev.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/pjmedia/src/pjmedia-videodev/sdl_dev.c b/pjmedia/src/pjmedia-videodev/sdl_dev.c
index d54b4418..c6d68746 100644
--- a/pjmedia/src/pjmedia-videodev/sdl_dev.c
+++ b/pjmedia/src/pjmedia-videodev/sdl_dev.c
@@ -914,22 +914,20 @@ static pj_status_t sdl_factory_create_stream(
strm->pool = pool;
strm->sf = sf;
pj_memcpy(&strm->vid_cb, cb, sizeof(*cb));
+ pj_list_init(&strm->list_entry);
+ strm->list_entry.stream = strm;
strm->user_data = user_data;
/* Create render stream here */
- if (param->dir & PJMEDIA_DIR_RENDER) {
- job_queue_post_job(sf->jq, sdl_create, strm, 0, &status);
- if (status != PJ_SUCCESS) {
- goto on_error;
- }
- pj_list_init(&strm->list_entry);
- strm->list_entry.stream = strm;
- pj_mutex_lock(strm->sf->mutex);
- if (pj_list_empty(&strm->sf->streams))
- pj_sem_post(strm->sf->sem);
- pj_list_insert_after(&strm->sf->streams, &strm->list_entry);
- pj_mutex_unlock(strm->sf->mutex);
+ job_queue_post_job(sf->jq, sdl_create, strm, 0, &status);
+ if (status != PJ_SUCCESS) {
+ goto on_error;
}
+ pj_mutex_lock(strm->sf->mutex);
+ if (pj_list_empty(&strm->sf->streams))
+ pj_sem_post(strm->sf->sem);
+ pj_list_insert_after(&strm->sf->streams, &strm->list_entry);
+ pj_mutex_unlock(strm->sf->mutex);
/* Apply the remaining settings */
if (param->flags & PJMEDIA_VID_DEV_CAP_OUTPUT_POSITION) {