Index: pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/ios_dev.m
===================================================================
--- pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/ios_dev.m	(revision 3592)
+++ pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/ios_dev.m	(revision 3593)
@@ -102,4 +102,5 @@
 static pj_status_t ios_factory_init(pjmedia_vid_dev_factory *f);
 static pj_status_t ios_factory_destroy(pjmedia_vid_dev_factory *f);
+static pj_status_t ios_factory_refresh(pjmedia_vid_dev_factory *f);
 static unsigned    ios_factory_get_dev_count(pjmedia_vid_dev_factory *f);
 static pj_status_t ios_factory_get_dev_info(pjmedia_vid_dev_factory *f,
@@ -139,5 +140,6 @@
     &ios_factory_get_dev_info,
     &ios_factory_default_param,
-    &ios_factory_create_stream
+    &ios_factory_create_stream,
+    &ios_factory_refresh
 };
 
@@ -239,4 +241,11 @@
     pj_pool_release(pool);
 
+    return PJ_SUCCESS;
+}
+
+/* API: refresh the list of devices */
+static pj_status_t ios_factory_refresh(pjmedia_vid_dev_factory *f)
+{
+    PJ_UNUSED_ARG(f);
     return PJ_SUCCESS;
 }
Index: pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/qt_dev.m
===================================================================
--- pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/qt_dev.m	(revision 3592)
+++ pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/qt_dev.m	(revision 3593)
@@ -59,4 +59,5 @@
     pjmedia_vid_dev_factory	 base;
     pj_pool_t			*pool;
+    pj_pool_t			*dev_pool;
     pj_pool_factory		*pf;
 
@@ -101,4 +102,5 @@
 static pj_status_t qt_factory_init(pjmedia_vid_dev_factory *f);
 static pj_status_t qt_factory_destroy(pjmedia_vid_dev_factory *f);
+static pj_status_t qt_factory_refresh(pjmedia_vid_dev_factory *f);
 static unsigned    qt_factory_get_dev_count(pjmedia_vid_dev_factory *f);
 static pj_status_t qt_factory_get_dev_info(pjmedia_vid_dev_factory *f,
@@ -136,5 +138,6 @@
     &qt_factory_get_dev_info,
     &qt_factory_default_param,
-    &qt_factory_create_stream
+    &qt_factory_create_stream,
+    &qt_factory_refresh
 };
 
@@ -176,4 +179,25 @@
 static pj_status_t qt_factory_init(pjmedia_vid_dev_factory *f)
 {
+    return qt_factory_refresh(f);
+}
+
+/* API: destroy factory */
+static pj_status_t qt_factory_destroy(pjmedia_vid_dev_factory *f)
+{
+    struct qt_factory *qf = (struct qt_factory*)f;
+    pj_pool_t *pool = qf->pool;
+
+    if (qf->dev_pool)
+        pj_pool_release(qf->dev_pool);
+    qf->pool = NULL;
+    if (pool)
+        pj_pool_release(pool);
+
+    return PJ_SUCCESS;
+}
+
+/* API: refresh the list of devices */
+static pj_status_t qt_factory_refresh(pjmedia_vid_dev_factory *f)
+{
     struct qt_factory *qf = (struct qt_factory*)f;
     struct qt_dev_info *qdi;
@@ -181,5 +205,10 @@
     NSAutoreleasePool *apool = [[NSAutoreleasePool alloc]init];
     NSArray *dev_array;
-
+    
+    if (qf->dev_pool) {
+        pj_pool_release(qf->dev_pool);
+        qf->dev_pool = NULL;
+    }
+    
     dev_array = [QTCaptureDevice inputDevices];
     for (i = 0; i < [dev_array count]; i++) {
@@ -194,7 +223,9 @@
     /* Initialize input and output devices here */
     qf->dev_count = 0;
+    qf->dev_pool = pj_pool_create(qf->pf, "qt video", 500, 500, NULL);
+    
     qf->dev_info = (struct qt_dev_info*)
-		   pj_pool_calloc(qf->pool, dev_count,
-				  sizeof(struct qt_dev_info));
+    pj_pool_calloc(qf->dev_pool, dev_count,
+                   sizeof(struct qt_dev_info));
     for (i = 0; i < [dev_array count]; i++) {
 	QTCaptureDevice *dev = [dev_array objectAtIndex:i];
@@ -207,14 +238,14 @@
 	    pj_bzero(qdi, sizeof(*qdi));
 	    [[dev localizedDisplayName] getCString:qdi->info.name
-					maxLength:sizeof(qdi->info.name)
-					encoding:
-					[NSString defaultCStringEncoding]];
+                                        maxLength:sizeof(qdi->info.name)
+                                        encoding:
+                                        [NSString defaultCStringEncoding]];
 	    [[dev uniqueID] getCString:qdi->dev_id
-			    maxLength:sizeof(qdi->dev_id)
-			    encoding:[NSString defaultCStringEncoding]];
+                            maxLength:sizeof(qdi->dev_id)
+                            encoding:[NSString defaultCStringEncoding]];
 	    strcpy(qdi->info.driver, "QT");	    
 	    qdi->info.dir = PJMEDIA_DIR_CAPTURE;
 	    qdi->info.has_callback = PJ_TRUE;
-
+            
 	    qdi->info.fmt_cnt = 0;
 	    for (k = 0; k < [[dev formatDescriptions] count]; k++) {
@@ -231,6 +262,6 @@
 	    qdi->info.caps = PJMEDIA_VID_DEV_CAP_FORMAT;
 	    qdi->info.fmt = (pjmedia_format*)
-			    pj_pool_calloc(qf->pool, qdi->info.fmt_cnt,
-					   sizeof(pjmedia_format));
+            pj_pool_calloc(qf->dev_pool, qdi->info.fmt_cnt,
+                           sizeof(pjmedia_format));
 	    for (j = k = 0; k < [[dev formatDescriptions] count]; k++) {
 		unsigned l;
@@ -249,26 +280,14 @@
 		}
 	    }
-
+            
 	    PJ_LOG(4, (THIS_FILE, " dev_id %d: %s", i, qdi->info.name));    
 	}
     }
-
+    
     [apool release];
     
-    PJ_LOG(4, (THIS_FILE, "qt video initialized with %d devices",
+    PJ_LOG(4, (THIS_FILE, "qt video has %d devices",
 	       qf->dev_count));
     
-    return PJ_SUCCESS;
-}
-
-/* API: destroy factory */
-static pj_status_t qt_factory_destroy(pjmedia_vid_dev_factory *f)
-{
-    struct qt_factory *qf = (struct qt_factory*)f;
-    pj_pool_t *pool = qf->pool;
-
-    qf->pool = NULL;
-    pj_pool_release(pool);
-
     return PJ_SUCCESS;
 }
@@ -384,5 +403,5 @@
     PJ_ASSERT_RETURN(param->fmt.type == PJMEDIA_TYPE_VIDEO &&
 		     param->fmt.detail_type == PJMEDIA_FORMAT_DETAIL_VIDEO &&
-                     param->dir == PJMEDIA_DIR_RENDER,
+                     param->dir == PJMEDIA_DIR_CAPTURE,
 		     PJ_EINVAL);
 
