diff options
author | Benny Prijono <bennylp@teluu.com> | 2014-02-04 13:24:28 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2014-02-04 13:24:28 +0000 |
commit | 0319fbf86e14b1a470652914835b6be668556b99 (patch) | |
tree | 8d6548935105c2af083c520cd2993593a1c5e729 /pjmedia | |
parent | 1f205882e7ad93179c13c398723cc8851c647c63 (diff) |
Fixed #1732: Error setting audio output route in BlackBerry 10 (BB10) version 10.2.1
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4730 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r-- | pjmedia/src/pjmedia-audiodev/bb10_dev.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/pjmedia/src/pjmedia-audiodev/bb10_dev.c b/pjmedia/src/pjmedia-audiodev/bb10_dev.c index 89b3f2c8..32466148 100644 --- a/pjmedia/src/pjmedia-audiodev/bb10_dev.c +++ b/pjmedia/src/pjmedia-audiodev/bb10_dev.c @@ -454,7 +454,6 @@ static int pb_thread_func (void *arg) if ((result = snd_pcm_plugin_prepare(stream->pb_pcm, SND_PCM_CHANNEL_PLAYBACK)) < 0) { - close_play_pcm(stream); TRACE_((THIS_FILE, "pb_thread_func failed prepare = %d", result)); return PJ_SUCCESS; } @@ -515,7 +514,6 @@ static int pb_thread_func (void *arg) } flush_play(stream); - close_play_pcm(stream); TRACE_((THIS_FILE, "pb_thread_func: Stopped")); return PJ_SUCCESS; @@ -550,7 +548,6 @@ static int ca_thread_func (void *arg) if ((result = snd_pcm_plugin_prepare (stream->ca_pcm, SND_PCM_CHANNEL_CAPTURE)) < 0) { - close_capture_pcm(stream); TRACE_((THIS_FILE, "ca_thread_func failed prepare = %d", result)); return PJ_SUCCESS; } @@ -616,7 +613,6 @@ static int ca_thread_func (void *arg) } flush_capture(stream); - close_capture_pcm(stream); TRACE_((THIS_FILE, "ca_thread_func: Stopped")); return PJ_SUCCESS; @@ -1032,11 +1028,25 @@ static pj_status_t bb10_stream_set_cap(pjmedia_aud_stream *strm, (stream->param.dir & PJMEDIA_DIR_PLAYBACK)) { pjmedia_aud_dev_route route; + pj_bool_t need_restart; pj_status_t ret; PJ_ASSERT_RETURN(value, PJ_EINVAL); + /* OS 10.2.1 requires pausing audio stream */ + need_restart = (stream->pb_thread != NULL); + if (need_restart) { + PJ_LOG(4,(THIS_FILE, "pausing audio stream..")); + ret = bb10_stream_stop(strm); + if (ret != PJ_SUCCESS) { + PJ_PERROR(1,(THIS_FILE, ret, "Error pausing stream")); + return ret; + } + } + route = *((pjmedia_aud_dev_route*)value); + PJ_LOG(4,(THIS_FILE, "setting audio route to %d..", route)); + /* Use the initialization function which lazy-inits the * handle for routing */ @@ -1045,6 +1055,15 @@ static pj_status_t bb10_stream_set_cap(pjmedia_aud_stream *strm, } else { ret = bb10_initialize_playback_ctrl(stream,false); } + + if (need_restart) { + PJ_LOG(4,(THIS_FILE, "resuming audio stream..")); + ret = bb10_stream_start(strm); + if (ret != PJ_SUCCESS) { + PJ_PERROR(1,(THIS_FILE, ret, "Error resuming stream")); + } + } + return ret; } else if (cap==PJMEDIA_AUD_DEV_CAP_EC && @@ -1129,6 +1148,9 @@ static pj_status_t bb10_stream_destroy (pjmedia_aud_stream *s) bb10_stream_stop (s); + close_play_pcm(stream); + close_capture_pcm(stream); + pj_pool_release (stream->pool); return PJ_SUCCESS; |