Index: media/audio/linux/audio_manager_linux.cc |
diff --git a/media/audio/linux/audio_manager_linux.cc b/media/audio/linux/audio_manager_linux.cc |
index b3d21f5956308fba572b51b2f70dafdb720984d5..9fa4799fd72a8cfde34a92f2255f7bfaba42b53d 100644 |
--- a/media/audio/linux/audio_manager_linux.cc |
+++ b/media/audio/linux/audio_manager_linux.cc |
@@ -59,6 +59,12 @@ AudioManagerLinux::AudioManagerLinux() |
} |
AudioManagerLinux::~AudioManagerLinux() { |
+ // Make sure we stop the thread first. If we let the default destructor to |
+ // destruct the members, we may destroy audio streams before stopping the |
+ // thread, resulting an unexpected behavior. |
+ // This way we make sure activities of the audio streams are all stopped |
+ // before we destroy them. |
+ audio_thread_.Stop(); |
active_streams_.clear(); |
} |