File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -121,30 +121,12 @@ func_pause_resume_pipeline()
121121 # expr rand(): produces random numbers between 0 and 1
122122 # after ms: Ms must be an integer giving a time in milliseconds.
123123 # The command sleeps for ms milliseconds and then returns.
124- dlogi " $pcm to command: $cmd -D $dev -r $rate -c $channel -f $fmt -vv -i $file -q"
125- expect << END &
126- spawn $cmd -D $dev -r $rate -c $channel -f $fmt -vv -i $file -q
127- set i 1
128- expect {
129- "*#*+*\%" {
130- set sleep_t [expr int([expr rand() * $rnd_range ]) + $rnd_min ]
131- puts "\r(\$ i/$repeat_count ) pcm'$pcm ' cmd'$cmd ' id'$idx ': Wait for \$ sleep_t ms before pause"
132- send " "
133- after \$ sleep_t
134- exp_continue
135- }
136- "*PAUSE*" {
137- set sleep_t [expr int([expr rand() * $rnd_range ]) + $rnd_min ]
138- puts "\r(\$ i/$repeat_count ) pcm'$pcm ' cmd'$cmd ' id'$idx ': Wait for \$ sleep_t ms before resume"
139- send " "
140- after \$ sleep_t
141- incr i
142- if { \$ i > $repeat_count } { exit 0 }
143- exp_continue
144- }
145- }
146- exit 1
147- END
124+
125+ local shortname=" cmd$idx $cmd $pcm "
126+
127+ dlogi " Starting: apause.exp $cmd -D $dev -r $rate -c $channel -f $fmt -vv -i $file &"
128+ " $TOPDIR " /case-lib/apause.exp " $shortname " " $repeat_count " " $rnd_min " " $rnd_range " \
129+ " $cmd " -D " $dev " -r " $rate " -c " $channel " -f " $fmt " -vv -i " $file " &
148130}
149131
150132# to prevent infinite loop, 5 second per a repeat is plenty
163145 do
164146 func_pause_resume_pipeline " $idx "
165147 pid_lst=(" ${pid_lst[@]} " $! )
148+ # Stagger a bit to avoid preambles interleaved with each other.
149+ # It's very far from perfect but it helps a little bit.
150+ sleep 0.1
166151 done
167152 # wait for expect script finished
168153 dlogi " wait for expect process finished"
You can’t perform that action at this time.
0 commit comments