[asterisk-commits] sruffell: branch sruffell/asterisk-1.4-transcoder r157028 - /team/sruffell/as...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Nov 14 16:57:10 CST 2008


Author: sruffell
Date: Fri Nov 14 16:57:09 2008
New Revision: 157028

URL: http://svn.digium.com/view/asterisk?view=rev&rev=157028
Log:
Another take at this...

Modified:
    team/sruffell/asterisk-1.4-transcoder/codecs/codec_dahdi.c

Modified: team/sruffell/asterisk-1.4-transcoder/codecs/codec_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/sruffell/asterisk-1.4-transcoder/codecs/codec_dahdi.c?view=diff&rev=157028&r1=157027&r2=157028
==============================================================================
--- team/sruffell/asterisk-1.4-transcoder/codecs/codec_dahdi.c (original)
+++ team/sruffell/asterisk-1.4-transcoder/codecs/codec_dahdi.c Fri Nov 14 16:57:09 2008
@@ -168,33 +168,24 @@
 
 	if (f->subclass) {
 		int write_size;
-		if (!f->datalen) {
-			/* If the datalen is 0, we'll just ignore the frame. */
-			res = -1;
-			pvt->samples += f->samples;
-			if (option_verbose > 2)
-				ast_verbose(VERBOSE_PREFIX_3 "codec_zap: " \
-				 "dropping frame of size 0\n");
-		} else if (SLINTOULAW == ztp->soft_slin) {
-			/* If we received a frame in signed linear format, and the
-			 * hardware doesn't support signed linear format, we need to
-			 * convert it before sending it to the hardware. */
+		/* If we received a frame in signed linear format, and the
+		 * hardware doesn't support signed linear format, we need to
+		 * convert it before sending it to the hardware. */
+		if (SLINTOULAW == ztp->soft_slin) {
 			lintoulaw(pvt, f);
 			write_size = sizeof(ztp->ulaw_buffer);
 			res = write(ztp->fd, ztp->ulaw_buffer, sizeof(ztp->ulaw_buffer)); 
 		} else {
 			write_size = f->datalen;
 			res = write(ztp->fd, f->data, f->datalen); 
-
-			if (-1 == res) {
-				ast_log(LOG_ERROR, "Failed to write to transcoder: %s\n", strerror(errno));
-			}
-			if (write_size != res) {
-				ast_log(LOG_ERROR, "Requested write of %d bytes, but only wrote %d bytes.\n", f->datalen, res);
-			}
-			res = -1;
-			pvt->samples += f->samples;
-		}
+		}
+		if ((-1 == res) && (option_verbose > 3)) {
+			ast_log(LOG_ERROR, "Failed to write to transcoder: %s\n", strerror(errno));
+		} else if (write_size != res) {
+			ast_log(LOG_ERROR, "Requested write of %d bytes, but only wrote %d bytes.\n", f->datalen, res);
+		}
+		res = -1;
+		pvt->samples += f->samples;
 	} else {
 		/* Fake a return frame for calculation purposes */
 		ztp->fake = 2;




More information about the asterisk-commits mailing list