File: 0003-Flip-default-behavior-for-metadata.map-strip-argumen.patch

package info (click to toggle)
liquidsoap 2.3.2-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 11,912 kB
  • sloc: ml: 67,867; javascript: 24,842; ansic: 273; xml: 114; sh: 96; lisp: 96; makefile: 26
file content (723 lines) | stat: -rw-r--r-- 22,445 bytes parent folder | download
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
From: Romain Beauxis <toots@rastageeks.org>
Date: Wed, 9 Apr 2025 21:30:34 -0500
Subject: Flip default behavior for `metadata.map` strip argument. (#4447)

Applied-Upstream: 30c41bafcceae8d5fd62ae4a79ddc78efb9f7743

---
 CHANGES.md                                     | 14 +++++++++
 src/core/operators/map_metadata.ml             | 40 ++++++++++++++++++++------
 tests/media/ffmpeg_filter_changing_rate.liq    |  2 +-
 tests/regression/AC5109.liq                    |  4 +--
 tests/regression/GH1129.liq                    |  6 ++--
 tests/regression/GH1279.liq                    |  4 +--
 tests/regression/GH1327.liq                    |  6 ++--
 tests/regression/GH4163.liq                    | 17 +++++++++--
 tests/regression/GH4281-2.liq                  | 10 +++++--
 tests/regression/GH4281.liq                    | 10 +++++--
 tests/regression/append-merge.liq              |  4 ++-
 tests/regression/seek_track_map.liq            |  2 +-
 tests/streams/cross-override-end.liq           | 11 +++++--
 tests/streams/cross-override-start.liq         | 11 +++++--
 tests/streams/cross-override.liq               | 11 +++++--
 tests/streams/cross-persist-end-override.liq   | 11 +++++--
 tests/streams/cross-persist-override.liq       | 11 +++++--
 tests/streams/cross-persist-start-override.liq | 11 +++++--
 tests/streams/cross.liq                        | 10 +++++--
 tests/streams/crossfade-plot.liq               |  2 ++
 tests/streams/crossfade.liq                    | 10 +++++--
 tests/streams/fades-overrides.liq              | 11 +++++--
 tests/streams/fades-persistent-override.liq    | 11 +++++--
 tests/streams/hls_id3v2.liq                    |  1 +
 tests/streams/random.liq                       |  4 +--
 tests/streams/rotate.liq                       |  7 ++++-
 26 files changed, 190 insertions(+), 51 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index e1228be..fdd7f0b 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,3 +1,17 @@
+# 2.3.3 (unreleased)
+
+Fixed:
+
+- Do not send empty metadata to shoutcast servers (#4408)
+
+Changed:
+
+- Changed default value of `metadata.map` `strip` argument to `true` and `insert_missing`
+  to `false` Added `settings.metadata.map.strip` and `settings.metadata.map.insert_missing`
+  configuration keys to revert to previous defaults. (#4447)
+
+---
+
 # 2.3.2 (2025-04-01) 🃏

 New:
diff --git a/src/core/operators/map_metadata.ml b/src/core/operators/map_metadata.ml
index f4d18e1..1dfecd3 100644
--- a/src/core/operators/map_metadata.ml
+++ b/src/core/operators/map_metadata.ml
@@ -22,6 +22,22 @@

 open Source

+let conf_metadata =
+  Dtools.Conf.void ~p:(Configure.conf#plug "Metadata") "Metadata settings"
+
+let conf_metadata_map =
+  Dtools.Conf.void ~p:(conf_metadata#plug "map") "Metadata map settings"
+
+let conf_metadata_map_strip =
+  Dtools.Conf.bool
+    ~p:(conf_metadata_map#plug "strip")
+    ~d:true "Default value for the `strip` parameter."
+
+let conf_metadata_map_insert_missing =
+  Dtools.Conf.bool
+    ~p:(conf_metadata_map#plug "insert_missing")
+    ~d:false "Default value for the `insert_missing` parameter."
+
 class map_metadata source rewrite_f insert_missing update strip =
   object (self)
     inherit operator ~name:"metadata.map" [source]
@@ -89,18 +105,20 @@ let register =
           "Update metadata. If false, existing metadata are cleared and only \
            returned values are set as new metadata." );
       ( "strip",
-        Lang.bool_t,
-        Some (Lang.bool false),
+        Lang.nullable_t Lang.bool_t,
+        Some Lang.null,
         Some
           "Completely remove empty metadata. Operates on both empty values and \
-           empty metadata chunk." );
+           empty metadata chunk. Defaults to `settings.metadata.map.strip` \
+           when `null`." );
       ( "insert_missing",
-        Lang.bool_t,
-        Some (Lang.bool true),
+        Lang.nullable_t Lang.bool_t,
+        Some Lang.null,
         Some
           "Treat track beginnings without metadata as having empty ones. The \
            operational order is: create empty if needed, map and strip if \
-           enabled." );
+           enabled. Defaults to `settings.metadata.map.insert_missing` when \
+           `null`." );
       ("", return_t, None, None);
     ]
     ~category:`Track ~descr:"Rewrite metadata on the fly using a function."
@@ -110,6 +128,12 @@ let register =
       assert (field = Frame.Fields.metadata);
       let f = Lang.assoc "" 1 p in
       let update = Lang.to_bool (List.assoc "update" p) in
-      let strip = Lang.to_bool (List.assoc "strip" p) in
-      let missing = Lang.to_bool (List.assoc "insert_missing" p) in
+      let strip = Lang.to_valued_option Lang.to_bool (List.assoc "strip" p) in
+      let strip = Option.value ~default:conf_metadata_map_strip#get strip in
+      let missing =
+        Lang.to_valued_option Lang.to_bool (List.assoc "insert_missing" p)
+      in
+      let missing =
+        Option.value ~default:conf_metadata_map_insert_missing#get missing
+      in
       (field, new map_metadata source f missing update strip))
diff --git a/tests/media/ffmpeg_filter_changing_rate.liq b/tests/media/ffmpeg_filter_changing_rate.liq
index 0df077b..3c79b17 100644
--- a/tests/media/ffmpeg_filter_changing_rate.liq
+++ b/tests/media/ffmpeg_filter_changing_rate.liq
@@ -27,7 +27,7 @@ end
 s = single(fname)
 s' = single(fname2)
 last = single(id="last", fname)
-last = metadata.map(fun (_) -> [("title", "done")], last)
+last = metadata.map(insert_missing=true, fun (_) -> [("title", "done")], last)
 s = sequence([s, s', s, s', s, last, s, s', s])
 s = f(s)
 done = ref(false)
diff --git a/tests/regression/AC5109.liq b/tests/regression/AC5109.liq
index e372c55..a9a768f 100644
--- a/tests/regression/AC5109.liq
+++ b/tests/regression/AC5109.liq
@@ -7,9 +7,9 @@ s = sequence([s1, s2])

 def transition(a, b) =
   s1 = sine(duration=0.5)
-  s1 = metadata.map(fun (_) -> [("type", "s1")], s1)
+  s1 = metadata.map(insert_missing=true, fun (_) -> [("type", "s1")], s1)
   s2 = sine(duration=0.5)
-  s2 = metadata.map(fun (_) -> [("type", "s2")], s2)
+  s2 = metadata.map(insert_missing=true, fun (_) -> [("type", "s2")], s2)
   sequence(
     [(a.source : source), (s1 : source), (s2 : source), (b.source : source)]
   )
diff --git a/tests/regression/GH1129.liq b/tests/regression/GH1129.liq
index 3421ec9..1777a64 100644
--- a/tests/regression/GH1129.liq
+++ b/tests/regression/GH1129.liq
@@ -9,7 +9,7 @@ def m1(_) =
   [("id", "s1")]
 end

-s1 = metadata.map(id="s1", m1, s1)
+s1 = metadata.map(insert_missing=true, id="s1", m1, s1)
 s2_ready = ref(false)
 s2 = switch(id="s2", [({!s2_ready}, blank(duration=0.04))])

@@ -17,14 +17,14 @@ def m2(_) =
   [("id", "s2")]
 end

-s2 = metadata.map(id="s2", m2, s2)
+s2 = metadata.map(insert_missing=true, id="s2", m2, s2)
 s3 = blank(id="s3", duration=0.04)

 def m3(_) =
   [("id", "s3")]
 end

-s3 = metadata.map(id="s3", m3, s3)
+s3 = metadata.map(insert_missing=true, id="s3", m3, s3)

 def f(m) =
   s2_ready := !s2_ready or m["id"] == "s3"
diff --git a/tests/regression/GH1279.liq b/tests/regression/GH1279.liq
index e53143b..f9784a0 100644
--- a/tests/regression/GH1279.liq
+++ b/tests/regression/GH1279.liq
@@ -5,14 +5,14 @@ def m1(_) =
   [("id", "s1")]
 end

-s1 = metadata.map(id="s1", m1, s1)
+s1 = metadata.map(insert_missing=true, id="s1", m1, s1)
 s2 = blank(duration=0.04)

 def m2(_) =
   [("id", "s2")]
 end

-s2 = metadata.map(id="s2", m2, s2)
+s2 = metadata.map(insert_missing=true, id="s2", m2, s2)

 def f(m) =
   selected := list.add(m["id"], !selected)
diff --git a/tests/regression/GH1327.liq b/tests/regression/GH1327.liq
index 037fb6c..891a669 100644
--- a/tests/regression/GH1327.liq
+++ b/tests/regression/GH1327.liq
@@ -8,7 +8,7 @@ def m1(_) =
   [("id", "s1")]
 end

-s1 = metadata.map(id="s1", m1, s1)
+s1 = metadata.map(insert_missing=true, id="s1", m1, s1)

 s2 = blank(duration=0.1)

@@ -16,7 +16,7 @@ def m2(_) =
   [("id", "s2")]
 end

-s2 = metadata.map(id="s2", m2, s2)
+s2 = metadata.map(insert_missing=true, id="s2", m2, s2)

 def f(m) =
   selected := list.add(m["id"], !selected)
@@ -30,7 +30,7 @@ def m_noise(_) =
   [("id", "noise")]
 end

-noise = metadata.map(id="noise", m_noise, noise())
+noise = metadata.map(insert_missing=true, id="noise", m_noise, noise())

 ready = ref(false)

diff --git a/tests/regression/GH4163.liq b/tests/regression/GH4163.liq
index 65cc60a..c4cbe08 100644
--- a/tests/regression/GH4163.liq
+++ b/tests/regression/GH4163.liq
@@ -1,11 +1,17 @@
 first_blank =
   metadata.map(
-    id="first_blank", fun (_) -> [("title", "first_blank")], blank(duration=3.)
+    insert_missing=true,
+    id="first_blank",
+    fun (_) -> [("title", "first_blank")],
+    blank(duration=3.)
   )

 after_blank =
   metadata.map(
-    id="after_blank", fun (_) -> [("title", "after_blank")], sine(duration=10.)
+    insert_missing=true,
+    id="after_blank",
+    fun (_) -> [("title", "after_blank")],
+    sine(duration=10.)
   )

 blank_sequence = sequence(id="blank_sequence", [first_blank, after_blank])
@@ -14,7 +20,12 @@ blank_strip =
   blank.strip(id="blank_strip", max_blank=5., start_blank=true, blank_sequence)

 fallback_sine =
-  metadata.map(id="fallback_sine", fun (_) -> [("title", "fallback")], sine())
+  metadata.map(
+    insert_missing=true,
+    id="fallback_sine",
+    fun (_) -> [("title", "fallback")],
+    sine()
+  )

 s =
   fallback(
diff --git a/tests/regression/GH4281-2.liq b/tests/regression/GH4281-2.liq
index 5a0176c..43c942e 100644
--- a/tests/regression/GH4281-2.liq
+++ b/tests/regression/GH4281-2.liq
@@ -1,8 +1,14 @@
 d = sequence([sine(duration=3.), sine(duration=3.)])
-d = metadata.map(update=false, (fun (_) -> [("title", "delay")]), d)
+d =
+  metadata.map(
+    insert_missing=true, update=false, (fun (_) -> [("title", "delay")]), d
+  )

 f = sequence([sine(duration=3.), sine(duration=3.)])
-f = metadata.map(update=false, (fun (_) -> [("title", "fallback")]), f)
+f =
+  metadata.map(
+    insert_missing=true, update=false, (fun (_) -> [("title", "fallback")]), f
+  )

 s = fallback([delay(initial=true, 1., d), f])

diff --git a/tests/regression/GH4281.liq b/tests/regression/GH4281.liq
index 3b0dade..e371c8f 100644
--- a/tests/regression/GH4281.liq
+++ b/tests/regression/GH4281.liq
@@ -1,8 +1,14 @@
 d = sequence([sine(duration=3.), sine(duration=3.)])
-d = metadata.map(update=false, (fun (_) -> [("title", "delay")]), d)
+d =
+  metadata.map(
+    insert_missing=true, update=false, (fun (_) -> [("title", "delay")]), d
+  )

 f = sequence([sine(duration=3.), sine(duration=3.)])
-f = metadata.map(update=false, (fun (_) -> [("title", "fallback")]), f)
+f =
+  metadata.map(
+    insert_missing=true, update=false, (fun (_) -> [("title", "fallback")]), f
+  )

 s = fallback([delay(1., d), f])

diff --git a/tests/regression/append-merge.liq b/tests/regression/append-merge.liq
index 28065f9..b80ed92 100644
--- a/tests/regression/append-merge.liq
+++ b/tests/regression/append-merge.liq
@@ -2,7 +2,9 @@ music = chop(every=1., metadata=[("source", "s1")], sine(amplitude=0.1, 440.))

 def next(_) =
   s = sine(amplitude=0.1, duration=.5, 880.)
-  metadata.map(insert_missing=true, fun (_) -> [("source", "s2")], s)
+  metadata.map(
+    insert_missing=true, fun (_) -> [("source", "s2")], s
+  )
 end

 s = append(merge=true, music, next)
diff --git a/tests/regression/seek_track_map.liq b/tests/regression/seek_track_map.liq
index cfbd457..3e5c3e2 100644
--- a/tests/regression/seek_track_map.liq
+++ b/tests/regression/seek_track_map.liq
@@ -8,7 +8,7 @@ def set_cues(s) =
     [("liq_cue_in", "#{in}"), ("liq_cue_out", "#{out}")]
   end

-  metadata.map(f, s)
+  metadata.map(insert_missing=true, f, s)
 end

 s = set_cues(s)
diff --git a/tests/streams/cross-override-end.liq b/tests/streams/cross-override-end.liq
index 04b1108..98c97a9 100644
--- a/tests/streams/cross-override-end.liq
+++ b/tests/streams/cross-override-end.liq
@@ -1,11 +1,15 @@
 success = ref(false)

 a = sine(duration=5., 440.)
-a = metadata.map(id="a", update=false, (fun (_) -> [("source", "a")]), a)
+a =
+  metadata.map(
+    insert_missing=true, id="a", update=false, (fun (_) -> [("source", "a")]), a
+  )

 b = sine(duration=5., 880.)
 b =
   metadata.map(
+    insert_missing=true,
     id="b",
     update=false,
     (fun (_) -> [("source", "b"), ("liq_cross_end_duration", "1.1")]),
@@ -13,7 +17,10 @@ b =
   )

 c = sine(duration=5., 440.)
-c = metadata.map(id="c", update=false, (fun (_) -> [("source", "c")]), c)
+c =
+  metadata.map(
+    insert_missing=true, id="c", update=false, (fun (_) -> [("source", "c")]), c
+  )

 s = sequence([a, b, c])
 s = crossfade(end_duration=5., start_duration=4., s)
diff --git a/tests/streams/cross-override-start.liq b/tests/streams/cross-override-start.liq
index 22db72c..6a7d1f8 100644
--- a/tests/streams/cross-override-start.liq
+++ b/tests/streams/cross-override-start.liq
@@ -1,11 +1,15 @@
 success = ref(false)

 a = sine(duration=5., 440.)
-a = metadata.map(id="a", update=false, (fun (_) -> [("source", "a")]), a)
+a =
+  metadata.map(
+    insert_missing=true, id="a", update=false, (fun (_) -> [("source", "a")]), a
+  )

 b = sine(duration=5., 880.)
 b =
   metadata.map(
+    insert_missing=true,
     id="b",
     update=false,
     (fun (_) -> [("source", "b"), ("liq_cross_start_duration", "1.1")]),
@@ -13,7 +17,10 @@ b =
   )

 c = sine(duration=5., 440.)
-c = metadata.map(id="c", update=false, (fun (_) -> [("source", "c")]), c)
+c =
+  metadata.map(
+    insert_missing=true, id="c", update=false, (fun (_) -> [("source", "c")]), c
+  )

 s = sequence([a, b, c])
 s = crossfade(start_duration=5., end_duration=4., s)
diff --git a/tests/streams/cross-override.liq b/tests/streams/cross-override.liq
index 7446fc0..be81360 100644
--- a/tests/streams/cross-override.liq
+++ b/tests/streams/cross-override.liq
@@ -1,11 +1,15 @@
 success = ref(false)

 a = sine(duration=5., 440.)
-a = metadata.map(id="a", update=false, (fun (_) -> [("source", "a")]), a)
+a =
+  metadata.map(
+    insert_missing=true, id="a", update=false, (fun (_) -> [("source", "a")]), a
+  )

 b = sine(duration=5., 880.)
 b =
   metadata.map(
+    insert_missing=true,
     id="b",
     update=false,
     (fun (_) -> [("source", "b"), ("liq_cross_duration", "1.1")]),
@@ -13,7 +17,10 @@ b =
   )

 c = sine(duration=5., 440.)
-c = metadata.map(id="c", update=false, (fun (_) -> [("source", "c")]), c)
+c =
+  metadata.map(
+    insert_missing=true, id="c", update=false, (fun (_) -> [("source", "c")]), c
+  )

 s = sequence([a, b, c])
 s = crossfade(duration=5., s)
diff --git a/tests/streams/cross-persist-end-override.liq b/tests/streams/cross-persist-end-override.liq
index c6ef962..f5c2c5a 100644
--- a/tests/streams/cross-persist-end-override.liq
+++ b/tests/streams/cross-persist-end-override.liq
@@ -1,11 +1,15 @@
 success = ref(false)

 a = sine(duration=5., 440.)
-a = metadata.map(id="a", update=false, (fun (_) -> [("source", "a")]), a)
+a =
+  metadata.map(
+    insert_missing=true, id="a", update=false, (fun (_) -> [("source", "a")]), a
+  )

 b = sine(duration=5., 880.)
 b =
   metadata.map(
+    insert_missing=true,
     id="b",
     update=false,
     (fun (_) -> [("source", "b"), ("liq_cross_end_duration", "1.1")]),
@@ -13,7 +17,10 @@ b =
   )

 c = sine(duration=5., 440.)
-c = metadata.map(id="c", update=false, (fun (_) -> [("source", "c")]), c)
+c =
+  metadata.map(
+    insert_missing=true, id="c", update=false, (fun (_) -> [("source", "c")]), c
+  )

 s = sequence([a, b, c])
 s = crossfade(persist_override=true, start_duration=5., end_duration=4., s)
diff --git a/tests/streams/cross-persist-override.liq b/tests/streams/cross-persist-override.liq
index 05eb631..817157d 100644
--- a/tests/streams/cross-persist-override.liq
+++ b/tests/streams/cross-persist-override.liq
@@ -1,11 +1,15 @@
 success = ref(false)

 a = sine(duration=5., 440.)
-a = metadata.map(id="a", update=false, (fun (_) -> [("source", "a")]), a)
+a =
+  metadata.map(
+    insert_missing=true, id="a", update=false, (fun (_) -> [("source", "a")]), a
+  )

 b = sine(duration=5., 880.)
 b =
   metadata.map(
+    insert_missing=true,
     id="b",
     update=false,
     (fun (_) -> [("source", "b"), ("liq_cross_duration", "1.1")]),
@@ -13,7 +17,10 @@ b =
   )

 c = sine(duration=5., 440.)
-c = metadata.map(id="c", update=false, (fun (_) -> [("source", "c")]), c)
+c =
+  metadata.map(
+    insert_missing=true, id="c", update=false, (fun (_) -> [("source", "c")]), c
+  )

 s = sequence([a, b, c])
 s = crossfade(persist_override=true, duration=5., s)
diff --git a/tests/streams/cross-persist-start-override.liq b/tests/streams/cross-persist-start-override.liq
index bf3e85d..d3854aa 100644
--- a/tests/streams/cross-persist-start-override.liq
+++ b/tests/streams/cross-persist-start-override.liq
@@ -1,11 +1,15 @@
 success = ref(false)

 a = sine(duration=5., 440.)
-a = metadata.map(id="a", update=false, (fun (_) -> [("source", "a")]), a)
+a =
+  metadata.map(
+    insert_missing=true, id="a", update=false, (fun (_) -> [("source", "a")]), a
+  )

 b = sine(duration=5., 880.)
 b =
   metadata.map(
+    insert_missing=true,
     id="b",
     update=false,
     (fun (_) -> [("source", "b"), ("liq_cross_start_duration", "1.1")]),
@@ -13,7 +17,10 @@ b =
   )

 c = sine(duration=5., 440.)
-c = metadata.map(id="c", update=false, (fun (_) -> [("source", "c")]), c)
+c =
+  metadata.map(
+    insert_missing=true, id="c", update=false, (fun (_) -> [("source", "c")]), c
+  )

 s = sequence([a, b, c])
 s = crossfade(persist_override=true, start_duration=5., end_duration=4., s)
diff --git a/tests/streams/cross.liq b/tests/streams/cross.liq
index f96f3ce..bf5be70 100644
--- a/tests/streams/cross.liq
+++ b/tests/streams/cross.liq
@@ -1,8 +1,14 @@
 video.frame.rate.set(24)
 a = sine(duration=5., 440.)
-a = metadata.map(update=false, (fun (_) -> [("title", "a")]), a)
+a =
+  metadata.map(
+    insert_missing=true, update=false, (fun (_) -> [("title", "a")]), a
+  )
 b = sine(duration=5., 880.)
-b = metadata.map(update=false, (fun (_) -> [("title", "b")]), b)
+b =
+  metadata.map(
+    insert_missing=true, update=false, (fun (_) -> [("title", "b")]), b
+  )
 s = sequence([a, b])

 def t(a, b) =
diff --git a/tests/streams/crossfade-plot.liq b/tests/streams/crossfade-plot.liq
index dd8c92f..3aebbdc 100644
--- a/tests/streams/crossfade-plot.liq
+++ b/tests/streams/crossfade-plot.liq
@@ -3,6 +3,7 @@ log.level := 5
 a = sine(duration=20., 440.)
 a =
   metadata.map(
+    insert_missing=true,
     update=false,
     fun (_) ->
       [
@@ -18,6 +19,7 @@ a =
 b = sine(duration=20., 880.)
 b =
   metadata.map(
+    insert_missing=true,
     update=false,
     fun (_) ->
       [
diff --git a/tests/streams/crossfade.liq b/tests/streams/crossfade.liq
index cd195d3..d6df92f 100644
--- a/tests/streams/crossfade.liq
+++ b/tests/streams/crossfade.liq
@@ -1,10 +1,16 @@
 video.frame.rate.set(24)

 a = sine(duration=20., 440.)
-a = metadata.map(update=false, (fun (_) -> [("title", "a")]), a)
+a =
+  metadata.map(
+    insert_missing=true, update=false, (fun (_) -> [("title", "a")]), a
+  )

 b = sine(duration=20., 880.)
-b = metadata.map(update=false, (fun (_) -> [("title", "b")]), b)
+b =
+  metadata.map(
+    insert_missing=true, update=false, (fun (_) -> [("title", "b")]), b
+  )

 s = sequence([a, b])

diff --git a/tests/streams/fades-overrides.liq b/tests/streams/fades-overrides.liq
index a5cd276..07e3db2 100644
--- a/tests/streams/fades-overrides.liq
+++ b/tests/streams/fades-overrides.liq
@@ -1,11 +1,15 @@
 success = ref(false)

 a = sine(duration=5., 440.)
-a = metadata.map(update=false, (fun (_) -> [("source", "a")]), a)
+a =
+  metadata.map(
+    insert_missing=true, update=false, (fun (_) -> [("source", "a")]), a
+  )

 b = sine(duration=5., 880.)
 b =
   metadata.map(
+    insert_missing=true,
     update=false,
     (
       fun (_) ->
@@ -21,7 +25,10 @@ b =
   )

 c = sine(duration=5., 440.)
-c = metadata.map(update=false, (fun (_) -> [("source", "c")]), c)
+c =
+  metadata.map(
+    insert_missing=true, update=false, (fun (_) -> [("source", "c")]), c
+  )

 s = sequence([a, b, c])

diff --git a/tests/streams/fades-persistent-override.liq b/tests/streams/fades-persistent-override.liq
index a24d76a..a3666b1 100644
--- a/tests/streams/fades-persistent-override.liq
+++ b/tests/streams/fades-persistent-override.liq
@@ -1,11 +1,15 @@
 success = ref(false)

 a = sine(duration=5., 440.)
-a = metadata.map(update=false, (fun (_) -> [("source", "a")]), a)
+a =
+  metadata.map(
+    insert_missing=true, update=false, (fun (_) -> [("source", "a")]), a
+  )

 b = sine(duration=5., 880.)
 b =
   metadata.map(
+    insert_missing=true,
     update=false,
     (
       fun (_) ->
@@ -21,7 +25,10 @@ b =
   )

 c = sine(duration=5., 440.)
-c = metadata.map(update=false, (fun (_) -> [("source", "c")]), c)
+c =
+  metadata.map(
+    insert_missing=true, update=false, (fun (_) -> [("source", "c")]), c
+  )

 s = sequence([a, b, c])

diff --git a/tests/streams/hls_id3v2.liq b/tests/streams/hls_id3v2.liq
index a48e38c..03bc357 100644
--- a/tests/streams/hls_id3v2.liq
+++ b/tests/streams/hls_id3v2.liq
@@ -167,6 +167,7 @@ end
 s = sine()
 s =
   metadata.map(
+    insert_missing=true,
     fun (_) ->
       [
         (
diff --git a/tests/streams/random.liq b/tests/streams/random.liq
index b85a99c..d55959a 100644
--- a/tests/streams/random.liq
+++ b/tests/streams/random.liq
@@ -9,7 +9,7 @@ def m1(_) =
   [("id", "s1")]
 end

-s1 = metadata.map(id="s1-map", m1, s1)
+s1 = metadata.map(insert_missing=true, id="s1-map", m1, s1)
 s1_ready = ref(true)
 s1 = switch(id="s1", track_sensitive=false, [(s1_ready, s1)])
 s1_weight = ref(1)
@@ -19,7 +19,7 @@ def m2(_) =
   [("id", "s2")]
 end

-s2 = metadata.map(id="s2-map", m2, s2)
+s2 = metadata.map(insert_missing=true, id="s2-map", m2, s2)
 s2_ready = ref(false)
 s2 = switch(id="s2", track_sensitive=false, [(s2_ready, s2)])
 s2_weight = ref(1)
diff --git a/tests/streams/rotate.liq b/tests/streams/rotate.liq
index 1c6c845..804f728 100644
--- a/tests/streams/rotate.liq
+++ b/tests/streams/rotate.liq
@@ -1,5 +1,10 @@
 def mksource(id="", url) =
-  metadata.map(id=id, fun (_) -> [("source", id)], mksafe(playlist(url)))
+  metadata.map(
+    insert_missing=true,
+    id=id,
+    fun (_) -> [("source", id)],
+    mksafe(playlist(url))
+  )
 end

 jingles = mksource("jingles", "jingles")