Various fixes for audio device

- Move define:BRUNO to where it should be
- Move Bruno playout starting before play thread process to prevent racing
  condition (play thread starts requesting for buffer but playout is not
  started yet)
- Set record frequency to 16k due to Namuga microphone's restriction

Change-Id: Ia3e15583ff0d3e7363300813a9187c5a0a942fcd
diff --git a/build/common.gypi b/build/common.gypi
index 122a520..f589a17 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -1199,6 +1199,9 @@
       ['OS=="win" and branding=="Chrome"', {
         'defines': ['ENABLE_SWIFTSHADER'],
       }],
+      ['bruno==1', {
+        'defines': ['BRUNO'],
+      }],
     ],  # conditions for 'target_defaults'
     'target_conditions': [
       ['enable_wexit_time_destructors==1', {
@@ -2695,7 +2698,6 @@
       ],
     }],
     ['bruno==1', {
-      'defines': ['BRUNO'],
       'make_global_settings': [
         ['CC.target'  , '<(bruno_cross_compile)' + 'gcc'],
         ['CXX.target' , '<(bruno_cross_compile)' + 'g++'],
diff --git a/src/modules/audio_device/main/source/linux/audio_device_alsa_linux.cc b/src/modules/audio_device/main/source/linux/audio_device_alsa_linux.cc
index e6ff130..6582b68 100644
--- a/src/modules/audio_device/main/source/linux/audio_device_alsa_linux.cc
+++ b/src/modules/audio_device/main/source/linux/audio_device_alsa_linux.cc
@@ -52,7 +52,12 @@
 static const unsigned int ALSA_PLAYOUT_FREQ = 48000;
 static const unsigned int ALSA_PLAYOUT_CH = 2;
 static const unsigned int ALSA_PLAYOUT_LATENCY = 40*1000; // in us
+#ifdef BRUNO
+// Namuga camera only support up to 16k audio capturing frequency.
+static const unsigned int ALSA_CAPTURE_FREQ = 16000;
+#else
 static const unsigned int ALSA_CAPTURE_FREQ = 48000;
+#endif  // BRUNO
 static const unsigned int ALSA_CAPTURE_CH = 2;
 static const unsigned int ALSA_CAPTURE_LATENCY = 40*1000; // in us
 static const unsigned int ALSA_PLAYOUT_WAIT_TIMEOUT = 5; // in ms
@@ -1770,6 +1775,10 @@
       return -1;
     }
 
+#ifdef BRUNO
+    int errVal = _handlePlayout->Start();
+#endif  // BRUNO
+
     // PLAYOUT
     const char* threadName = "webrtc_audio_module_play_thread";
     _ptrThreadPlay =  ThreadWrapper::CreateThread(PlayThreadFunc,
@@ -1800,11 +1809,9 @@
     }
     _playThreadID = threadID;
 
-#ifdef BRUNO
-    int errVal = _handlePlayout->Start();
-#else
+#ifndef BRUNO
     int errVal = LATE(snd_pcm_prepare)(_handlePlayout);
-#endif  // BRUNO
+#endif  // !BRUNO
     if (errVal < 0)
     {
         WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id,