[asterisk-commits] mmichelson: branch 1.4 r188582 - /branches/1.4/main/file.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 15 15:04:24 CDT 2009


Author: mmichelson
Date: Wed Apr 15 15:04:20 2009
New Revision: 188582

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=188582
Log:
Update ast_readvideo_callback to match ast_readaudio_callback.

This fixes potential refcount errors that may occur on ast_filestreams.

AST-208


Modified:
    branches/1.4/main/file.c

Modified: branches/1.4/main/file.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/main/file.c?view=diff&rev=188582&r1=188581&r2=188582
==============================================================================
--- branches/1.4/main/file.c (original)
+++ branches/1.4/main/file.c Wed Apr 15 15:04:20 2009
@@ -798,11 +798,20 @@
 
 	while (!whennext) {
 		struct ast_frame *fr = s->fmt->read(s, &whennext);
-		if (!fr || ast_write(s->owner, fr)) { /* no stream or error, as above */
-			if (fr)
+		if (fr) {
+			ast_set_flag(fr, AST_FRFLAG_FROM_FILESTREAM);
+			ao2_ref(s, +1);
+		}
+		if (!fr /* stream complete */ || ast_write(s->owner, fr) /* error writing */) {
+			if (fr) {
 				ast_log(LOG_WARNING, "Failed to write frame\n");
+				ast_frfree(fr);
+			}
 			s->owner->vstreamid = -1;
 			return FSREAD_FAILURE;
+		}
+		if (fr) {
+			ast_frfree(fr);
 		}
 	}
 




More information about the asterisk-commits mailing list