diff options
| author | Jokler <jokler@protonmail.com> | 2020-02-20 05:20:24 +0100 |
|---|---|---|
| committer | Jokler <jokler@protonmail.com> | 2020-02-22 23:20:10 +0100 |
| commit | b9edd85baae9ee483a2d403c641801adc585d26d (patch) | |
| tree | 31299c7b972a90d544d1f19537d6cf64951939a5 | |
| parent | 1e0fb0a8fab5c9f2f8a58c2637830522863ef04f (diff) | |
| download | pokebot-b9edd85baae9ee483a2d403c641801adc585d26d.tar.gz pokebot-b9edd85baae9ee483a2d403c641801adc585d26d.zip | |
Fix quit message when nothing is playing
| -rw-r--r-- | src/audio_player.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/audio_player.rs b/src/audio_player.rs index 4bcab56..d231c72 100644 --- a/src/audio_player.rs +++ b/src/audio_player.rs @@ -108,6 +108,12 @@ impl AudioPlayer { pipeline.add(&audio_bin)?; + // The documentation says that we have to make sure to handle + // all messages if auto flushing is deactivated. + // I hope our way of reading messages is good enough. + // + // https://gstreamer.freedesktop.org/documentation/gstreamer/gstpipeline.html#gst_pipeline_set_auto_flush_bus + pipeline.set_auto_flush_bus(false); pipeline.set_state(gst::State::Ready)?; Ok(AudioPlayer { @@ -306,11 +312,11 @@ impl AudioPlayer { pub fn quit(&self, reason: String) { info!("Quitting audio player"); - if let Err(e) = self + if let Err(_) = self .bus .post(&gst::Message::new_application(gst::Structure::new_empty("quit")).build()) { - warn!("Failed to send \"quit\" app event: {}", e); + warn!("Tried to send \"quit\" app event on flushing bus."); } let sender = self.sender.read().unwrap(); @@ -395,7 +401,7 @@ impl AudioPlayer { } } _ => { - //debug!("{:?}", msg) + //debug!("Unhandled message on bus: {:?}", msg) } }; } |
