]> git.sesse.net Git - vlc/blobdiff - src/video_output/control.c
stream_filter: dash: remove double initialization
[vlc] / src / video_output / control.c
index 1806137f7fe5b601d6912a98bb625d9b09b702bb..f317196b4139e438e5bb49c63f6148f2fec63086 100644 (file)
@@ -6,19 +6,19 @@
  *
  * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 #ifdef HAVE_CONFIG_H
@@ -46,6 +46,7 @@ void vout_control_cmd_Clean(vout_control_cmd_t *cmd)
     case VOUT_CONTROL_OSD_TITLE:
     case VOUT_CONTROL_CHANGE_FILTERS:
     case VOUT_CONTROL_CHANGE_SUB_SOURCES:
+    case VOUT_CONTROL_CHANGE_SUB_FILTERS:
         free(cmd->u.string);
         break;
     default:
@@ -61,7 +62,6 @@ void vout_control_Init(vout_control_t *ctrl)
     vlc_cond_init(&ctrl->wait_acknowledge);
 
     ctrl->is_dead = false;
-    ctrl->is_sleeping = false;
     ctrl->can_sleep = true;
     ctrl->is_processing = false;
     ARRAY_INIT(ctrl->cmd);
@@ -114,8 +114,7 @@ void vout_control_Wake(vout_control_t *ctrl)
 {
     vlc_mutex_lock(&ctrl->lock);
     ctrl->can_sleep = false;
-    if (ctrl->is_sleeping)
-        vlc_cond_signal(&ctrl->wait_request);
+    vlc_cond_signal(&ctrl->wait_request);
     vlc_mutex_unlock(&ctrl->lock);
 }
 
@@ -186,16 +185,11 @@ int vout_control_Pop(vout_control_t *ctrl, vout_control_cmd_t *cmd,
         vlc_cond_broadcast(&ctrl->wait_acknowledge);
 
         const mtime_t max_deadline = mdate() + timeout;
+        const mtime_t wait_deadline = deadline <= VLC_TS_INVALID ? max_deadline : __MIN(deadline, max_deadline);
 
-        /* Supurious wake up are perfectly fine */
-        if (deadline <= VLC_TS_INVALID) {
-            ctrl->is_sleeping = true;
-            if (ctrl->can_sleep)
-                vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock, max_deadline);
-            ctrl->is_sleeping = false;
-        } else {
-            vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock, __MIN(deadline, max_deadline));
-        }
+        /* Spurious wakeups are perfectly fine */
+        if (ctrl->can_sleep)
+            vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock, wait_deadline);
     }
 
     bool has_cmd;