summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorSeungha Yang <seungha@centricular.com>2020-10-07 05:05:25 +0900
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2020-10-11 10:24:11 +0000
commit51a8882f5f783ceca9f705a1647a222604994d9f (patch)
treebbe096f47bcdad8ae2c9a5e8a633be61cc52b03d /sys
parent0e4057ad1b4158453f0ef1a4b0abe4ffd0754cfd (diff)
downloadgstreamer-plugins-bad-51a8882f5f783ceca9f705a1647a222604994d9f.tar.gz
mfvideosrc: Use only the first video stream per device
Non-first video stream might not be working with current implementation. It could be non-video (e.g., photo source) and then ReadSample() might be blocked forever. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1676>
Diffstat (limited to 'sys')
-rw-r--r--sys/mediafoundation/gstmfsourcereader.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/mediafoundation/gstmfsourcereader.cpp b/sys/mediafoundation/gstmfsourcereader.cpp
index 1aa849f80..396151e81 100644
--- a/sys/mediafoundation/gstmfsourcereader.cpp
+++ b/sys/mediafoundation/gstmfsourcereader.cpp
@@ -168,7 +168,14 @@ gst_mf_enum_media_type_from_source_reader (IMFSourceReader * source_reader,
g_return_val_if_fail (source_reader != NULL, FALSE);
g_return_val_if_fail (media_types != NULL, FALSE);
- for (i = 0;; i++) {
+ {
+ /* Retrive only the first video stream. non-first video stream might be
+ * photo stream which doesn't seem to be working propertly in this implementation.
+ *
+ * Note: Chromium seems to be using the first video stream
+ * https://github.com/chromium/chromium/blob/ccd149af47315e4c6f2fc45d55be1b271f39062c/media/capture/video/win/video_capture_device_factory_win.cc
+ */
+ i = MF_SOURCE_READER_FIRST_VIDEO_STREAM;
for (j = 0;; j++) {
ComPtr<IMFMediaType> media_type;