1 diff --git a/src/base/msfactory.c b/src/base/msfactory.c
2 index 14f868e3..2e3445a1 100644
3 --- a/src/base/msfactory.c
4 +++ b/src/base/msfactory.c
5 @@ -770,7 +770,12 @@ void ms_factory_uninit_plugins(MSFactory *factory){
8 void ms_factory_init_plugins(MSFactory *obj) {
9 - if (obj->plugins_dir == NULL) {
10 + char *package_plugins_dir;
11 + // Force plugin dir from environment variable if set
12 + package_plugins_dir = getenv("MEDIASTREAMER_PLUGINS_DIR");
13 + if (package_plugins_dir != NULL) {
14 + ms_factory_set_plugins_dir(obj, package_plugins_dir);
15 + } else if (obj->plugins_dir == NULL) {
17 char *dir = getPluginsDir();