diff --git a/src/gst.rs b/src/gst.rs
index 0c1b57b..37d9028 100644
--- a/src/gst.rs
+++ b/src/gst.rs
@@ -3,7 +3,7 @@
pub use self::maybe_app_src::MaybeAppSrc;
use gstreamer::prelude::Cast;
-use gstreamer::{Bin,Structure};
+use gstreamer::{Bin, Structure};
use gstreamer_app::AppSrc;
//use gstreamer_rtsp::RTSPLowerTrans;
use gstreamer_rtsp_server::prelude::*;
@@ -50,15 +50,19 @@ impl RtspServer {
let factory = RTSPMediaFactory::new();
for permitted_user in permitted_users {
- factory.add_role_from_structure(
- &Structure::new(
- &permitted_user,
- &[
- (*RTSP_PERM_MEDIA_FACTORY_ACCESS, &true),
- (*RTSP_PERM_MEDIA_FACTORY_CONSTRUCT, &true),
- ]
- )
- );
+ debug!("Permitting {} to access {}", permitted_user, names.join(", "));
+ self.add_watcher_role(&factory, &permitted_user)
+ }
+ // During auth, first it binds anonymously. At this point it checks
+ // RTSP_PERM_MEDIA_FACTORY_ACCESS to see if anyone can connect
+ // This is done before the auth token is loaded, possibliy an upstream bug there
+ // After checking RTSP_PERM_MEDIA_FACTORY_ACCESS anonymously
+ // It loads the auth token of the user and checks that users
+ // RTSP_PERM_MEDIA_FACTORY_CONSTRUCT allowing them to play
+ // As a result of this we must ensure that if anonymous is not granted watcher
+ // access that anon has at least RTSP_PERM_MEDIA_FACTORY_ACCESS
+ if ! permitted_users.contains(&"anonymous".to_string()) {
+ self.add_check_role(&factory, "anonymous");
}
//factory.set_protocols(RTSPLowerTrans::TCP);
@@ -100,11 +104,36 @@ impl RtspServer {
Ok(maybe_app_src)
}
- pub fn set_credentials(&self, credentials :&Vec