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