hc
2023-05-26 a23f51ed7a39e452c1037343a84d7db1ca2c5bd7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From 0acc284bc847cf9f6addb82f932be8b12d13afeb Mon Sep 17 00:00:00 2001
From: Jeffy Chen <jeffy.chen@rock-chips.com>
Date: Tue, 6 Apr 2021 10:51:35 +0800
Subject: [PATCH 1/2] filesrc: Fix stopping race in pull-mode
 
When using qtmultimedia + playbin3, there's a chance that stop() been
called before fill().
 
Setting uninitialized src fd to -1 instead of 0 to avoid reading the
stdin in that case.
 
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---
 plugins/elements/gstfilesrc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
 
diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c
index d7888ae..8168c04 100644
--- a/plugins/elements/gstfilesrc.c
+++ b/plugins/elements/gstfilesrc.c
@@ -216,7 +216,7 @@ static void
 gst_file_src_init (GstFileSrc * src)
 {
   src->filename = NULL;
-  src->fd = 0;
+  src->fd = -1;
   src->uri = NULL;
 
   src->is_regular = FALSE;
@@ -585,7 +585,7 @@ gst_file_src_stop (GstBaseSrc * basesrc)
   close (src->fd);
 
   /* zero out a lot of our state */
-  src->fd = 0;
+  src->fd = -1;
   src->is_regular = FALSE;
 
   return TRUE;
-- 
2.20.1