summaryrefslogtreecommitdiff
path: root/gtk2_ardour/transcode_ffmpeg.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2013-06-11 02:58:10 +0200
committerRobin Gareus <robin@gareus.org>2013-06-11 02:58:10 +0200
commit21a4ce62dc1f620a8881a27ac3c2eb8019c1fe5b (patch)
tree617d3ae0f50e8cfd9ea26b6160f84df198db45de /gtk2_ardour/transcode_ffmpeg.cc
parent1ca430babd9682fc403b561117f122bbd5e8adae (diff)
vtl: wait for output from ffprobe
fix code-ordering bug that sneaked in when re-factoring the parser.
Diffstat (limited to 'gtk2_ardour/transcode_ffmpeg.cc')
-rw-r--r--gtk2_ardour/transcode_ffmpeg.cc17
1 files changed, 12 insertions, 5 deletions
diff --git a/gtk2_ardour/transcode_ffmpeg.cc b/gtk2_ardour/transcode_ffmpeg.cc
index 56c55ff4ee..6e8bd07e93 100644
--- a/gtk2_ardour/transcode_ffmpeg.cc
+++ b/gtk2_ardour/transcode_ffmpeg.cc
@@ -114,8 +114,20 @@ TranscodeFfmpeg::probe ()
ffexit();
return false;
}
+
+ /* wait for ffprobe process to exit */
ffcmd->wait();
+ /* wait for interposer thread to copy all data.
+ * SystemExec::Terminated is emitted and ffcmd set to NULL */
+ int timeout = 300; // 1.5 sec
+ while (ffcmd && --timeout > 0) {
+ usleep(5000);
+ }
+ if (timeout == 0 || ffoutput.empty()) {
+ return false;
+ }
+
/* parse */
std::vector<std::vector<std::string> > lines;
@@ -231,11 +243,6 @@ TranscodeFfmpeg::probe ()
}
/* end parse */
-
- int timeout = 500;
- while (ffcmd && --timeout) usleep (1000); // wait until 'ffprobe' terminated.
- if (timeout == 0) return false;
-
#if 0 /* DEBUG */
printf("FPS: %f\n", m_fps);
printf("Duration: %lu frames\n",(unsigned long)m_duration);