From 5cc890cc043ee64a42c5288989627724a7891495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 23 May 2016 21:15:43 +0300 Subject: [PATCH] Add comments about which Source/Sink methods are called from which threads Source::get_size() / ::is_seekable() implementations need to be made thread-safe still. --- src/rssink.rs | 3 +++ src/rssource.rs | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/rssink.rs b/src/rssink.rs index 963367e2..a4710436 100644 --- a/src/rssink.rs +++ b/src/rssink.rs @@ -24,8 +24,11 @@ use std::ptr; use utils::*; pub trait Sink: Sync + Send { + // Called from any thread at any time fn set_uri(&mut self, uri_str: Option<&str>) -> bool; fn get_uri(&self) -> Option; + + // Called from the streaming thread only fn start(&mut self) -> bool; fn stop(&mut self) -> bool; fn render(&mut self, data: &[u8]) -> GstFlowReturn; diff --git a/src/rssource.rs b/src/rssource.rs index 32cc1c6a..0de7faf2 100644 --- a/src/rssource.rs +++ b/src/rssource.rs @@ -23,14 +23,19 @@ use std::ptr; use utils::*; pub trait Source: Sync + Send { + // Called from any thread at any time fn set_uri(&mut self, uri_str: Option<&str>) -> bool; fn get_uri(&self) -> Option; + + // Called from any thread between start/stop fn is_seekable(&self) -> bool; - fn get_size(&self) -> u64; + + // Called from the streaming thread only fn start(&mut self) -> bool; fn stop(&mut self) -> bool; fn fill(&mut self, offset: u64, data: &mut [u8]) -> Result; fn do_seek(&mut self, start: u64, stop: u64) -> bool; + fn get_size(&self) -> u64; } #[no_mangle]