feeder.c (170289) | feeder.c (170815) |
---|---|
1/*- 2 * Copyright (c) 1999 Cameron Grant <cg@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <dev/sound/pcm/sound.h> 28 29#include "feeder_if.h" 30 | 1/*- 2 * Copyright (c) 1999 Cameron Grant <cg@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <dev/sound/pcm/sound.h> 28 29#include "feeder_if.h" 30 |
31SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pcm/feeder.c 170289 2007-06-04 18:25:08Z dwmalone $"); | 31SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pcm/feeder.c 170815 2007-06-16 03:37:28Z ariff $"); |
32 33MALLOC_DEFINE(M_FEEDER, "feeder", "pcm feeder"); 34 35#define MAXFEEDERS 256 36#undef FEEDER_DEBUG 37 38int feeder_buffersize = FEEDBUFSZ; 39TUNABLE_INT("hw.snd.feeder_buffersize", &feeder_buffersize); --- 823 unchanged lines hidden (view full) --- 863 offset); 864 if (l > 0) 865 sndbuf_dispose(src, buffer + offset, l); 866 else 867 ch->feedcount--; 868 } else { 869 if (l > 0) 870 sndbuf_dispose(src, buffer, l); | 32 33MALLOC_DEFINE(M_FEEDER, "feeder", "pcm feeder"); 34 35#define MAXFEEDERS 256 36#undef FEEDER_DEBUG 37 38int feeder_buffersize = FEEDBUFSZ; 39TUNABLE_INT("hw.snd.feeder_buffersize", &feeder_buffersize); --- 823 unchanged lines hidden (view full) --- 863 offset); 864 if (l > 0) 865 sndbuf_dispose(src, buffer + offset, l); 866 else 867 ch->feedcount--; 868 } else { 869 if (l > 0) 870 sndbuf_dispose(src, buffer, l); |
871#if 1 | |
872 memset(buffer + l, 873 sndbuf_zerodata(sndbuf_getfmt(src)), 874 offset); 875 if (!(ch->flags & CHN_F_CLOSING)) 876 ch->xruns++; | 871 memset(buffer + l, 872 sndbuf_zerodata(sndbuf_getfmt(src)), 873 offset); 874 if (!(ch->flags & CHN_F_CLOSING)) 875 ch->xruns++; |
877#else 878 if (l < 1 || (ch->flags & CHN_F_CLOSING)) { 879 memset(buffer + l, 880 sndbuf_zerodata(sndbuf_getfmt(src)), 881 offset); 882 if (!(ch->flags & CHN_F_CLOSING)) 883 ch->xruns++; 884 } else { 885 int cp, tgt; 886 887 tgt = l; 888 while (offset > 0) { 889 cp = min(l, offset); 890 memcpy(buffer + tgt, buffer, cp); 891 offset -= cp; 892 tgt += cp; 893 } 894 ch->xruns++; 895 } 896#endif | |
897 } 898 } else if (l > 0) 899 sndbuf_dispose(src, buffer, l); 900 901 return count; 902} 903 904static kobj_method_t feeder_root_methods[] = { --- 13 unchanged lines hidden --- | 876 } 877 } else if (l > 0) 878 sndbuf_dispose(src, buffer, l); 879 880 return count; 881} 882 883static kobj_method_t feeder_root_methods[] = { --- 13 unchanged lines hidden --- |