Project import generated by Copybara.

NOKEYCHECK=True
GitOrigin-RevId: 84d2356e19416ed6e516baf33d39c5ba76afc1fa
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..651d356
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+alsa-lib-1.1.5
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..d5447de
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,126 @@
+#
+#    Copyright (c) 2010-2014 Nest, Inc.
+#    All rights reserved.
+#
+#    This document is the property of Nest. It is considered
+#    confidential and proprietary information.
+#
+#    This document may not be reproduced or transmitted in any form,
+#    in whole or in part, without the express written permission of
+#    Nest.
+#
+#    Description:
+#      This file is the makefile for the ALSA User space library
+#
+
+
+include pre.mak
+
+PackageName		:= alsa-lib
+
+PackageExtension	:= tar.bz2
+PackageSeparator	:= -
+
+PackagePatchArgs	:= -p1
+
+PackageArchive		:= $(PackageName).$(PackageExtension)
+PackageSourceDir	:= $(PackageName)$(PackageSeparator)$(PackageVersion)/
+
+PackageBuildMakefile	= $(call GenerateBuildPaths,Makefile)
+
+CleanPaths		+= $(PackageLicenseFile)
+
+AlsaUserIncDir		:= /usr/include/alsa/
+AlsaUserLibDir		:= /usr/lib/
+ifeq ($(BUILD_FEATURE_SIMULATOR),1)
+AsoundConfigFile	:= asound_sim.conf
+DebugFlags		:= -g -O0
+AlsaPulseDir		:= /usr/lib/x86_64-linux-gnu/alsa-lib/
+else
+AsoundConfigFile	:= asound.conf
+DebugFlags		:=
+AlsaPulseDir		:=
+endif
+
+SOURCEDIRS                      = $(PackageSourceDir)
+$(PackageSourceDir)_RULE_TARGET = $(BuildDirectory)/configure
+
+all: $(PackageDefaultGoal)
+
+# Generate the package license contents.
+
+$(PackageSourceDir)/LICENSE: $(BuildDirectory)/source
+
+$(PackageLicenseFile): $(PackageSourceDir)/LICENSE
+	$(copy-result)
+
+# Extract the source from the archive and apply patches, if any.
+
+$(PackageSourceDir): $(PackageArchive) $(PackagePatchPaths)
+	$(expand-and-patch-package)
+
+# Prepare the sources.
+
+$(BuildDirectory)/source: | $(PackageSourceDir) $(BuildDirectory)
+	$(Verbose)touch $@
+
+# Patch the sources, if necessary.
+
+$(BuildDirectory)/patch: $(BuildDirectory)/source
+	$(Verbose)touch $@
+
+# Generate the package build makefile.
+
+# Configure the source for building.
+$(BuildDirectory)/configure: PATH := $(HostBinDir):$(PATH)
+
+$(BuildDirectory)/configure: $(BuildDirectory)/source | $(PackageSourceDir) $(BuildDirectory)
+	$(Verbose)cd $(BuildDirectory) && \
+	$(CURDIR)/$(PackageSourceDir)/configure \
+	CC="$(CC) $(DebugFlags) $(CPPOPTFLAGS)" CXX="$(CXX) $(CPPOPTFLAGS)" AR=$(AR) RANLIB=$(RANLIB) STRIP=$(STRIP) \
+	CPPFLAGS="$(call ToolGenerateIncludeArgument,$(LinuxIncludePath))" \
+	INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
+	--build=$(HostTuple) \
+	--host=$(TargetTuple) \
+	--with-plugindir=$(AlsaPulseDir) \
+	--with-versioned=no \
+	--prefix=/usr \
+	--sysconfdir=/etc \
+	--localstatedir=/var \
+	--includedir=$(AlsaUserIncDir) \
+	--libdir=$(AlsaUserLibDir) \
+	--disable-rawmidi \
+	--disable-seq \
+	--disable-old-symbols \
+	--disable-python \
+	--disable-alisp
+	$(Verbose)touch $@
+
+# Build the source.
+#
+# We have to unset MAKEFLAGS since they confuse the package build otherwise.
+
+$(BuildDirectory)/build: $(BuildDirectory)/configure
+	$(Verbose)unset MAKEFLAGS && \
+	$(MAKE) $(JOBSFLAG) -C $(BuildDirectory) all
+	$(Verbose)touch $@
+
+# Stage the build to a temporary installation area.
+#
+# We have to unset MAKEFLAGS since they confuse the package build otherwise.
+
+$(BuildDirectory)/stage: $(BuildDirectory)/build | $(ResultDirectory)
+	$(Verbose)unset MAKEFLAGS && \
+	$(MAKE) $(JOBSFLAG) -C $(BuildDirectory) DESTDIR=$(ResultDirectory) install
+	$(Verbose)cp -f $(AsoundConfigFile) $(ResultDirectory)
+	$(Verbose)touch $@
+
+.PHONY: stage
+stage: $(BuildDirectory)/stage
+
+clean:
+	$(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
+	$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
+	$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
+
+include post.mak
diff --git a/alsa-lib.patches/alsa-lib-50.patch b/alsa-lib.patches/alsa-lib-50.patch
new file mode 100644
index 0000000..c63437a
--- /dev/null
+++ b/alsa-lib.patches/alsa-lib-50.patch
@@ -0,0 +1,43 @@
+diff -aruN alsa-lib-1.0.27.2/src/pcm/pcm_dmix.c alsa-lib-1.0.27.2.N/src/pcm/pcm_dmix.c
+--- alsa-lib-1.0.27.2/src/pcm/pcm_dmix.c	2017-08-14 10:28:26.855071601 -0700
++++ alsa-lib-1.0.27.2.N/src/pcm/pcm_dmix.c	2017-08-14 10:36:01.205629277 -0700
+@@ -769,6 +769,7 @@
+ static int snd_pcm_dmix_close(snd_pcm_t *pcm)
+ {
+ 	snd_pcm_direct_t *dmix = pcm->private_data;
++	SNDERR("Closing instance %x", pcm);
+ 
+ 	if (dmix->timer)
+ 		snd_timer_close(dmix->timer);
+@@ -787,6 +788,7 @@
+ 	free(dmix->bindings);
+ 	pcm->private_data = NULL;
+ 	free(dmix);
++	SNDERR("Closed instance %x", pcm);
+ 	return 0;
+ }
+ 
+@@ -1017,6 +1019,7 @@
+ 	if (first_instance) {
+ 		/* recursion is already checked in
+ 		   snd_pcm_direct_get_slave_ipc_offset() */
++		SNDERR("Opening first instance");
+ 		ret = snd_pcm_open_slave(&spcm, root, sconf, stream,
+ 					 mode | SND_PCM_NONBLOCK, NULL);
+ 		if (ret < 0) {
+@@ -1050,6 +1053,7 @@
+ 
+ 		dmix->shmptr->type = spcm->type;
+ 	} else {
++		SNDERR("Opening non-first instance");
+ 		if (dmix->shmptr->use_server) {
+ 			/* up semaphore to avoid deadlock */
+ 			snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
+@@ -1123,6 +1127,7 @@
+ 	snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
+ 
+ 	*pcmp = pcm;
++	SNDERR("Opened instance %x", pcm);
+ 	return 0;
+ 	
+  _err:
diff --git a/alsa-lib.tar.bz2 b/alsa-lib.tar.bz2
new file mode 100644
index 0000000..47cbad1
--- /dev/null
+++ b/alsa-lib.tar.bz2
Binary files differ
diff --git a/alsa-lib.url b/alsa-lib.url
new file mode 100644
index 0000000..c9bffb4
--- /dev/null
+++ b/alsa-lib.url
@@ -0,0 +1 @@
+ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.1.5.tar.bz2
diff --git a/alsa-lib.version b/alsa-lib.version
new file mode 100644
index 0000000..e25d8d9
--- /dev/null
+++ b/alsa-lib.version
@@ -0,0 +1 @@
+1.1.5