Always reset audio route in StopCapturingAudio

AudioCaptureManager.StopCapturingAudio can fail with errors like this:

    No audio data was captured. Perhaps this input is not plugged ?

When this happens, FpgaInputFlowWithAudio.ResetRoute is not called. This leaves
the Chameleon device in a bad state.

This commit makes it so ResetRoute is always called even if an exception is
raised.

BUG=chromium:956000
TEST=Don't play audio, call StartCapturingAudio and then StopCapturingAudio

Change-Id: Ie53fa3a987ead15dccc5797ba5703e2660be7546
Reviewed-on: https://chromium-review.googlesource.com/1591593
Commit-Ready: Yu-Hsuan Hsu <yuhsuan@chromium.org>
Tested-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
diff --git a/chameleond/devices/input_flow.py b/chameleond/devices/input_flow.py
index 5b23c92..544854d 100644
--- a/chameleond/devices/input_flow.py
+++ b/chameleond/devices/input_flow.py
@@ -495,12 +495,14 @@
       AudioCaptureManagerError: If captured time or page exceeds the limit.
       AudioCaptureManagerError: If there is no captured data.
     """
-    data_format = self._audio_capture_manager.StopCapturingAudio()
-    self.ResetRoute()
-    if self._audio_recorded_file:
-      return self._audio_recorded_file.name, data_format
-    else:
-      return None, None
+    try:
+      data_format = self._audio_capture_manager.StopCapturingAudio()
+      if self._audio_recorded_file:
+        return self._audio_recorded_file.name, data_format
+      else:
+        return None, None
+    finally:
+      self.ResetRoute()
 
   def ResetRoute(self):
     """Resets the audio route."""