Index: pjproject/trunk/pjmedia/src/pjmedia/pasound.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/pasound.c	(revision 320)
+++ pjproject/trunk/pjmedia/src/pjmedia/pasound.c	(revision 321)
@@ -33,5 +33,5 @@
 } snd_mgr;
 
-struct pj_snd_stream
+struct pjmedia_snd_stream
 {
     pj_pool_t	    *pool;
@@ -46,6 +46,6 @@
     pj_uint32_t	     overflow;
     void	    *user_data;
-    pj_snd_rec_cb    rec_cb;
-    pj_snd_play_cb   play_cb;
+    pjmedia_snd_rec_cb    rec_cb;
+    pjmedia_snd_play_cb   play_cb;
     pj_bool_t	     quit_flag;
     pj_bool_t	     thread_has_exited;
@@ -63,5 +63,5 @@
 			      void *userData )
 {
-    pj_snd_stream *stream = userData;
+    pjmedia_snd_stream *stream = userData;
     pj_status_t status;
 
@@ -103,5 +103,5 @@
 			     void *userData )
 {
-    pj_snd_stream *stream = userData;
+    pjmedia_snd_stream *stream = userData;
     pj_status_t status;
     unsigned size = frameCount * stream->bytes_per_sample;
@@ -141,5 +141,5 @@
  * Init sound library.
  */
-PJ_DEF(pj_status_t) pj_snd_init(pj_pool_factory *factory)
+PJ_DEF(pj_status_t) pjmedia_snd_init(pj_pool_factory *factory)
 {
     int err;
@@ -152,7 +152,7 @@
 			 Pa_GetHostApiCount()));
     PJ_LOG(4,(THIS_FILE, "Sound device count=%d",
-			 pj_snd_get_dev_count()));
-
-    return err;
+			 pjmedia_snd_get_dev_count()));
+
+    return err ? PJMEDIA_ERRNO_FROM_PORTAUDIO(err) : PJ_SUCCESS;
 }
 
@@ -161,5 +161,5 @@
  * Get device count.
  */
-PJ_DEF(int) pj_snd_get_dev_count(void)
+PJ_DEF(int) pjmedia_snd_get_dev_count(void)
 {
     return Pa_GetDeviceCount();
@@ -170,7 +170,7 @@
  * Get device info.
  */
-PJ_DEF(const pj_snd_dev_info*) pj_snd_get_dev_info(unsigned index)
-{
-    static pj_snd_dev_info info;
+PJ_DEF(const pjmedia_snd_dev_info*) pjmedia_snd_get_dev_info(unsigned index)
+{
+    static pjmedia_snd_dev_info info;
     const PaDeviceInfo *pa_info;
 
@@ -193,15 +193,15 @@
  * Open stream.
  */
-PJ_DEF(pj_status_t) pj_snd_open_recorder( int index,
+PJ_DEF(pj_status_t) pjmedia_snd_open_recorder( int index,
 					  unsigned clock_rate,
 					  unsigned channel_count,
 					  unsigned samples_per_frame,
 					  unsigned bits_per_sample,
-					  pj_snd_rec_cb rec_cb,
+					  pjmedia_snd_rec_cb rec_cb,
 					  void *user_data,
-					  pj_snd_stream **p_snd_strm)
+					  pjmedia_snd_stream **p_snd_strm)
 {
     pj_pool_t *pool;
-    pj_snd_stream *stream;
+    pjmedia_snd_stream *stream;
     PaStreamParameters inputParam;
     int sampleFormat;
@@ -278,15 +278,15 @@
 
 
-PJ_DEF(pj_status_t) pj_snd_open_player( int index,
+PJ_DEF(pj_status_t) pjmedia_snd_open_player( int index,
 					unsigned clock_rate,
 					unsigned channel_count,
 					unsigned samples_per_frame,
 					unsigned bits_per_sample,
-					pj_snd_play_cb play_cb,
+					pjmedia_snd_play_cb play_cb,
 					void *user_data,
-					pj_snd_stream **p_snd_strm)
+					pjmedia_snd_stream **p_snd_strm)
 {
     pj_pool_t *pool;
-    pj_snd_stream *stream;
+    pjmedia_snd_stream *stream;
     PaStreamParameters outputParam;
     int sampleFormat;
@@ -367,15 +367,15 @@
  * Start stream.
  */
-PJ_DEF(pj_status_t) pj_snd_stream_start(pj_snd_stream *stream)
-{
-    pj_status_t status;
+PJ_DEF(pj_status_t) pjmedia_snd_stream_start(pjmedia_snd_stream *stream)
+{
+    pj_status_t err;
 
     PJ_LOG(5,(THIS_FILE, "Starting %s stream..", stream->name.ptr));
 
-    status = Pa_StartStream(stream->stream);
-
-    PJ_LOG(5,(THIS_FILE, "Done, status=%d", status));
-
-    return status;
+    err = Pa_StartStream(stream->stream);
+
+    PJ_LOG(5,(THIS_FILE, "Done, status=%d", err));
+
+    return err ? PJMEDIA_ERRNO_FROM_PORTAUDIO(err) : PJ_SUCCESS;
 }
 
@@ -383,5 +383,5 @@
  * Stop stream.
  */
-PJ_DEF(pj_status_t) pj_snd_stream_stop(pj_snd_stream *stream)
+PJ_DEF(pj_status_t) pjmedia_snd_stream_stop(pjmedia_snd_stream *stream)
 {
     int i, err;
@@ -399,5 +399,5 @@
     PJ_LOG(5,(THIS_FILE, "Done, status=%d", err));
 
-    return err;
+    return err ? PJMEDIA_ERRNO_FROM_PORTAUDIO(err) : PJ_SUCCESS;
 }
 
@@ -405,5 +405,5 @@
  * Destroy stream.
  */
-PJ_DEF(pj_status_t) pj_snd_stream_close(pj_snd_stream *stream)
+PJ_DEF(pj_status_t) pjmedia_snd_stream_close(pjmedia_snd_stream *stream)
 {
     int i, err;
@@ -424,5 +424,6 @@
     err = Pa_CloseStream(stream->stream);
     pj_pool_release(stream->pool);
-    return err;
+
+    return err ? PJMEDIA_ERRNO_FROM_PORTAUDIO(err) : PJ_SUCCESS;
 }
 
@@ -430,9 +431,13 @@
  * Deinitialize sound library.
  */
-PJ_DEF(pj_status_t) pj_snd_deinit(void)
-{
+PJ_DEF(pj_status_t) pjmedia_snd_deinit(void)
+{
+    int err;
+
     PJ_LOG(4,(THIS_FILE, "PortAudio sound library shutting down.."));
 
-    return Pa_Terminate();
+    err = Pa_Terminate();
+
+    return err ? PJMEDIA_ERRNO_FROM_PORTAUDIO(err) : PJ_SUCCESS;
 }
 
