-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathAampConfig.cpp
More file actions
2140 lines (1997 loc) · 81.3 KB
/
AampConfig.cpp
File metadata and controls
2140 lines (1997 loc) · 81.3 KB
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
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* If not stated otherwise in this file or this component's license file the
* following copyright and licenses apply:
*
* Copyright 2018 RDK Management
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file AampConfig.cpp
* @brief Configuration related Functionality for AAMP
*/
#include "AampConfig.h"
#include "_base64.h"
#include "base16.h"
#include "AampJsonObject.h" // For JSON parsing
#include "AampUtils.h"
#include "aampgstplayer.h"
#include "SocUtils.h"
#include "PlayerRfc.h"
#include "PlayerExternalsInterface.h"
#include "PlayerSecInterface.h"
#include "abr.h"
#include <time.h>
#include <map>
//////////////// CAUTION !!!! STOP !!! Read this before you proceed !!!!!!! /////////////
/// 1. This Class handles Configuration Parameters of AAMP Player , only Config related functionality to be added
/// 2. Simple Steps to add a new configuration
/// a) Identify new configuration takes what value ( bool / int / string )
/// b) Add the new configuration string in README.txt with appropriate comment
/// c) Add a enum value for new config in AAMPConfigSettingInt, AAMPConfigSettingBool, AAMPConfigSettingFloat, or AAMPConfigSettingString.
/// d) Add the config string added in README and its equivalent enum value in corresponding
/// mConfigLookupTableInt, mConfigLookupTableBool, mConfigLookupTableFloat, or mConfigLookupTableString
/// e) Go to AampConfig constructor explicitly initialize of different value than default is required (int: 0, bool:false, float:0.0, string:"")
/// f) Thats it !! You added a new configuration . Use Set and Get function to
/// store and read value using enum config
/// g) IF any conversion required only (from config to usage, ex: sec to millisec ),
/// add specific Get function for each config
/// Not recommended . Better to have the conversion ( enum to string , sec to millisec etc ) where its consumed .
///////////////////////////////// Happy Configuration ////////////////////////////////////
#define ARRAY_SIZE(A) (sizeof(A)/sizeof(A[0]))
#define ERROR_TEXT_BAD_RANGE "Set failed. Input beyond the configured range"
typedef enum
{
eCONFIG_RANGE_ANY,
eCONFIG_RANGE_PORT,
eCONFIG_RANGE_DRM_SYSTEMS, // 0..eDRM_MAX_DRMSystems
eCONFIG_RANGE_LICENSE_WAIT, // MIN_LICENSE_KEY_ACQUIRE_WAIT_TIME..MAX_LICENSE_ACQ_WAIT_TIME
eCONFIG_RANGE_PTS_ERROR_THRESHOLD, // 0..MAX_PTS_ERRORS_THRESHOLD
eCONFIG_RANGE_PLAYLIST_CACHE_SIZE, // 0,15360, // Range for PlaylistCache size - upto 15 MB max
eCONFIG_RANGE_DASH_DRM_SESSIONS, // 1..MAX_DASH_DRM_SESSIONS
eCONFIG_RANGE_LANGUAGE_CODE, // 0,3
eCONFIG_RANGE_DECRYPT_ERROR_THRESHOLD, // 0..MAX_SEG_DRM_DECRYPT_FAIL_COUNT},
eCONFIG_RANGE_INJECT_ERROR_THRESHOLD, // 0..MAX_SEG_INJECT_FAIL_COUNT},
eCONFIG_RANGE_DOWNLOAD_DELAY, // 0..MAX_DOWNLOAD_DELAY_LIMIT_MS
eCONFIG_RANGE_PAUSE_BEHAVIOR, // ePAUSED_BEHAVIOR_AUTOPLAY_IMMEDIATE..ePAUSED_BEHAVIOR_MAX},
eCONFIG_RANGE_DOWNLOAD_ERROR_THRESHOLD, // 1..MAX_SEG_DOWNLOAD_FAIL_COUNT
eCONFIG_RANGE_INIT_FRAGMENT_CACHE, // 1..5
eCONFIG_RANGE_TIMEOUT, // 0..50
eCONFIG_RANGE_CURL_SOCK_STORE_SIZE, // 1..10
eCONFIG_RANGE_CURL_SSL_VERSION, // CURL_SSLVERSION_DEFAULT..CURL_SSLVERSION_TLSv1_3
eCONFIG_RANGE_TUNED_EVENT_CODE, // eTUNED_EVENT_ON_PLAYLIST_INDEXED..eTUNED_EVENT_ON_GST_PLAYING},
eCONFIG_RANGE_LIVEOFFSET, // 0..50
eCONFIG_RANGE_RAMPDOWN_LIMIT, // -1..50
eCONFIG_RANGE_CEA_PREFERRED, // -1..5
eCONFIG_RANGE_PLAYBACK_OFFSET, // -99999..INT_MAX
eCONFIG_RANGE_HARVEST_DURATION, // -1...10 HRS
eCONFIG_RANGE_ABSOLUTE_REPORTING, // eABSOLUTE_PROGRESS_EPOCH..eABSOLUTE_PROGRESS_MAX
eCONFIG_RANGE_LLDBUFFER, // 1 to 100 LLD buffer
eCONFIG_RANGE_SHOW_DIAGNOSTICS_OVERLAY,//0 to 2
eCONFIG_RANGE_MONITOR_AVSYNC_THRESHOLD_POSITIVE, //1ms to 10000ms
eCONFIG_RANGE_MONITOR_AVSYNC_THRESHOLD_NEGATIVE, //-1 to -10000ms
eCONFIG_RANGE_MONITOR_AVSYNC_JUMP_THRESHOLD,//1ms to 10000
eCONFIG_RANGE_MAX_VALUE,
} ConfigValidRange;
#define CONFIG_RANGE_ENUM_COUNT (eCONFIG_RANGE_MAX_VALUE)
/**
* @brief lookup table for categories of valid ranges, used for value validation
*/
static const struct
{
int minValue;
int maxValue;
ConfigValidRange type;
} mConfigValueValidRange[] =
{
{ 0, INT_MAX, eCONFIG_RANGE_ANY },
{ 1, 65535, eCONFIG_RANGE_PORT },
{ 0, eDRM_MAX_DRMSystems, eCONFIG_RANGE_DRM_SYSTEMS },
{ MIN_LICENSE_KEY_ACQUIRE_WAIT_TIME, MAX_LICENSE_ACQ_WAIT_TIME, eCONFIG_RANGE_LICENSE_WAIT },
{ 0, MAX_PTS_ERRORS_THRESHOLD, eCONFIG_RANGE_PTS_ERROR_THRESHOLD },
{ 0, 15360, eCONFIG_RANGE_PLAYLIST_CACHE_SIZE },
{ 1, MAX_DASH_DRM_SESSIONS, eCONFIG_RANGE_DASH_DRM_SESSIONS },
{ 0, 3, eCONFIG_RANGE_LANGUAGE_CODE },
{ 0, MAX_SEG_DRM_DECRYPT_FAIL_COUNT, eCONFIG_RANGE_DECRYPT_ERROR_THRESHOLD },
{ 0, MAX_SEG_INJECT_FAIL_COUNT, eCONFIG_RANGE_INJECT_ERROR_THRESHOLD },
{ 0, MAX_DOWNLOAD_DELAY_LIMIT_MS, eCONFIG_RANGE_DOWNLOAD_DELAY },
{ ePAUSED_BEHAVIOR_AUTOPLAY_IMMEDIATE, ePAUSED_BEHAVIOR_MAX, eCONFIG_RANGE_PAUSE_BEHAVIOR },
{ 1, MAX_SEG_DOWNLOAD_FAIL_COUNT, eCONFIG_RANGE_DOWNLOAD_ERROR_THRESHOLD },
{ 1, 5, eCONFIG_RANGE_INIT_FRAGMENT_CACHE },
{ 0, 50, eCONFIG_RANGE_TIMEOUT },
{ 1, 10, eCONFIG_RANGE_CURL_SOCK_STORE_SIZE },
{ CURL_SSLVERSION_DEFAULT, CURL_SSLVERSION_MAX_LAST, eCONFIG_RANGE_CURL_SSL_VERSION },
{ eTUNED_EVENT_ON_PLAYLIST_INDEXED, eTUNED_EVENT_ON_GST_PLAYING, eCONFIG_RANGE_TUNED_EVENT_CODE },
{ 0, 50, eCONFIG_RANGE_LIVEOFFSET },
{ -1, 50, eCONFIG_RANGE_RAMPDOWN_LIMIT },
{ -1, 5, eCONFIG_RANGE_CEA_PREFERRED },
{AAMP_DEFAULT_PLAYBACK_OFFSET, INT_MAX, eCONFIG_RANGE_PLAYBACK_OFFSET },
{-1, 60*60*10, eCONFIG_RANGE_HARVEST_DURATION },
{eABSOLUTE_PROGRESS_EPOCH, eABSOLUTE_PROGRESS_MAX, eCONFIG_RANGE_ABSOLUTE_REPORTING},
{ 1, 100, eCONFIG_RANGE_LLDBUFFER }, /** Minimum buffer should be a average chunk size(only int is possible), upper limit does not have much impact*/
{ eDIAG_OVERLAY_NONE, eDIAG_OVERLAY_EXTENDED, eCONFIG_RANGE_SHOW_DIAGNOSTICS_OVERLAY},
{ MIN_MONITOR_AVSYNC_POSITIVE_DELTA_MS, MAX_MONITOR_AVSYNC_POSITIVE_DELTA_MS, eCONFIG_RANGE_MONITOR_AVSYNC_THRESHOLD_POSITIVE},
{ MIN_MONITOR_AVSYNC_NEGATIVE_DELTA_MS, MAX_MONITOR_AVSYNC_NEGATIVE_DELTA_MS, eCONFIG_RANGE_MONITOR_AVSYNC_THRESHOLD_NEGATIVE},
{ MIN_MONITOR_AV_JUMP_THRESHOLD_MS, MAX_MONITOR_AV_JUMP_THRESHOLD_MS, eCONFIG_RANGE_MONITOR_AVSYNC_JUMP_THRESHOLD},
};
static ConfigPriority customOwner;
/**
* @brief AAMP Config Owners enum-string mapping table
*/
static const AampOwnerLookupEntry mOwnerLookupTable[] =
{
{"def",AAMP_DEFAULT_SETTING},
{"oper",AAMP_OPERATOR_SETTING},
{"stream",AAMP_STREAM_SETTING},
{"app",AAMP_APPLICATION_SETTING},
{"tune",AAMP_TUNE_SETTING},
{"cfg",AAMP_DEV_CFG_SETTING},
{"customcfg",AAMP_CUSTOM_DEV_CFG_SETTING},
{"unknown",AAMP_MAX_SETTING}
};
struct ConfigLookupEntryInt
{
int defaultValue;
const char* cmdString;
AAMPConfigSettingInt configEnum;
bool bConfigurableByOperatorRFC; // better to have a separate list?
ConfigValidRange validRange;
};
struct ConfigLookupEntryFloat
{
double defaultValue;
const char* cmdString;
AAMPConfigSettingFloat configEnum;
bool bConfigurableByOperatorRFC; // better to have a separate list?
ConfigValidRange validRange;
};
struct ConfigLookupEntryBool
{
bool defaultValue;
const char* cmdString;
AAMPConfigSettingBool configEnum;
bool bConfigurableByOperatorRFC; // better to have a separate list?
};
struct ConfigLookupEntryString
{
const char *defaultValue;
const char* cmdString;
AAMPConfigSettingString configEnum;
bool bConfigurableByOperatorRFC; // better to have a separate list?
};
#ifdef GST_SUBTEC_ENABLED
#define DEFAULT_VALUE_GST_SUBTEC_ENABLED true
#else
#define DEFAULT_VALUE_GST_SUBTEC_ENABLED false
#endif
#ifdef ENABLE_USE_SINGLE_PIPELINE
#define DEFAULT_VALUE_USE_SINGLE_PIPELINE true
#else
#define DEFAULT_VALUE_USE_SINGLE_PIPELINE false
#endif
/**
* @brief AAMPConfigSettingString metadata
* note that order must match the actual order of the enum; this is enforced with asserts to catch any wrong/missing declarations
*/
static const ConfigLookupEntryString mConfigLookupTableString[AAMPCONFIG_STRING_COUNT] =
{
{"","harvestPath",eAAMPConfig_HarvestPath,false},
{"","licenseServerUrl",eAAMPConfig_LicenseServerUrl,false},
{"","ckLicenseServerUrl",eAAMPConfig_CKLicenseServerUrl,false},
{"","prLicenseServerUrl",eAAMPConfig_PRLicenseServerUrl,false},
{"","wvLicenseServerUrl",eAAMPConfig_WVLicenseServerUrl,false},
{AAMP_USERAGENT_STRING,"userAgent",eAAMPConfig_UserAgent,false},
{"en,eng","preferredSubtitleLanguage",eAAMPConfig_SubTitleLanguage,false},
{"","customHeader",eAAMPConfig_CustomHeader,false},
{"","uriParameter",eAAMPConfig_URIParameter,false},
{"","networkProxy",eAAMPConfig_NetworkProxy,false},
{"","licenseProxy",eAAMPConfig_LicenseProxy,false},
{"","authToken",eAAMPConfig_AuthToken,false},
{"","log",eAAMPConfig_LogLevel,false},
{"","customHeaderLicense",eAAMPConfig_CustomHeaderLicense,false},
{"","preferredAudioRendition",eAAMPConfig_PreferredAudioRendition,false},
{"","preferredAudioCodec",eAAMPConfig_PreferredAudioCodec,false},
{"en,eng","preferredAudioLanguage",eAAMPConfig_PreferredAudioLanguage,false},
{"","preferredAudioLabel",eAAMPConfig_PreferredAudioLabel,false},
{"","preferredAudioType",eAAMPConfig_PreferredAudioType,false},
{"","preferredTextRendition",eAAMPConfig_PreferredTextRendition,false},
{"","preferredTextLanguage",eAAMPConfig_PreferredTextLanguage,false},
{"","preferredTextLabel",eAAMPConfig_PreferredTextLabel,false},
{"","preferredTextType",eAAMPConfig_PreferredTextType,false},
{"","customLicenseData",eAAMPConfig_CustomLicenseData,false},
{"urn:comcast:dai:2018","SchemeIdUriDaiStream",eAAMPConfig_SchemeIdUriDaiStream,true},
{"urn:comcast:x1:lin:ck","SchemeIdUriVssStream",eAAMPConfig_SchemeIdUriVssStream,true},
{"","LRHAcceptValue",eAAMPConfig_LRHAcceptValue,true},
{"","LRHContentType",eAAMPConfig_LRHContentType,true},
{"","gstlevel", eAAMPConfig_GstDebugLevel,false},
{"","tsbType", eAAMPConfig_TsbType, false},
{DEFAULT_TSB_LOCATION,"tsbLocation",eAAMPConfig_TsbLocation, true},
{"","networkPersonaFile", eAAMPConfig_NetworkPersonaFile, false},
};
/**
* @brief AAMPConfigSettingBool metadata
* note that order must match the actual order of the enum; this is enforced with asserts to catch any wrong/missing declarations
*/
static const ConfigLookupEntryBool mConfigLookupTableBool[AAMPCONFIG_BOOL_COUNT] =
{
{true,"abr",eAAMPConfig_EnableABR,false},
{true,"fog",eAAMPConfig_Fog,false},
{false,"preFetchIframePlaylist",eAAMPConfig_PrefetchIFramePlaylistDL,false},
{false,"throttle",eAAMPConfig_Throttle,false},
{false,"demuxAudioBeforeVideo",eAAMPConfig_DemuxAudioBeforeVideo,false},
{false,"disableEC3",eAAMPConfig_DisableEC3,true},
{false,"disableATMOS",eAAMPConfig_DisableATMOS,true},
{false,"disableAC4",eAAMPConfig_DisableAC4,true},
{false,"stereoOnly",eAAMPConfig_StereoOnly,true},
{false,"descriptiveTrackName",eAAMPConfig_DescriptiveTrackName,false},
{false,"disableAC3",eAAMPConfig_DisableAC3,true},
{true,"preferHEVC",eAAMPConfig_PreferHEVC,true},
{true,"disablePlaylistIndexEvent",eAAMPConfig_DisablePlaylistIndexEvent,false},
{true,"enableSubscribedTags",eAAMPConfig_EnableSubscribedTags,false},
{false,"dashIgnoreBaseUrlIfSlash",eAAMPConfig_DASHIgnoreBaseURLIfSlash,false},
{false,"licenseAnonymousRequest",eAAMPConfig_AnonymousLicenseRequest,false},
{false,"hlsAVTrackSyncUsingPDT",eAAMPConfig_HLSAVTrackSyncUsingStartTime,false},
{true,"mpdDiscontinuityHandling",eAAMPConfig_MPDDiscontinuityHandling,false},
{true,"mpdDiscontinuityHandlingCdvr",eAAMPConfig_MPDDiscontinuityHandlingCdvr,false},
{false,"forceHttp",eAAMPConfig_ForceHttp,false},
{true,"internalRetune",eAAMPConfig_InternalReTune,false},
{false,"audioOnlyPlayback",eAAMPConfig_AudioOnlyPlayback,false},
{false,"b64LicenseWrapping",eAAMPConfig_Base64LicenseWrapping,false},
{true,"gstBufferAndPlay",eAAMPConfig_GStreamerBufferingBeforePlay,false},
{false,"playreadyOutputProtection",eAAMPConfig_EnablePROutputProtection,false},
{true,"retuneOnBufferingTimeout",eAAMPConfig_ReTuneOnBufferingTimeout,false},
{true,"sslVerifyPeer",eAAMPConfig_SslVerifyPeer,false},
{false,"client-dai",eAAMPConfig_EnableClientDai,true}, // not changing this name , this is already in use for RFC
{false,"cdnAdsOnly",eAAMPConfig_PlayAdFromCDN,false},
{true,"enableVideoEndEvent",eAAMPConfig_EnableVideoEndEvent,true},
{true,"enableVideoRectangle",eAAMPConfig_EnableRectPropertyCfg,false},
{false,"reportVideoPTS",eAAMPConfig_ReportVideoPTS,false},
{false,"decoderUnavailableStrict",eAAMPConfig_DecoderUnavailableStrict,false},
{false,"appSrcForProgressivePlayback",eAAMPConfig_UseAppSrcForProgressivePlayback,false},
{false,"descriptiveAudioTrack",eAAMPConfig_DescriptiveAudioTrack,false},
{true,"reportBufferEvent",eAAMPConfig_ReportBufferEvent,false},
{false,"info",eAAMPConfig_InfoLogging,true},
{false,"debug",eAAMPConfig_DebugLogging,false},
{false,"trace",eAAMPConfig_TraceLogging,false},
{true,"warn",eAAMPConfig_WarnLogging,false},
{false,"failover",eAAMPConfig_FailoverLogging,false},
{false,"gst",eAAMPConfig_GSTLogging,false},
{false,"progress",eAAMPConfig_ProgressLogging,false},
{false,"curl",eAAMPConfig_CurlLogging,false},
{false,"curlLicense",eAAMPConfig_CurlLicenseLogging,false},
{false,"logMetadata",eAAMPConfig_MetadataLogging,false},
{false,"curlHeader",eAAMPConfig_CurlHeader,false},
{false,"stream",eAAMPConfig_StreamLogging,false},
{false,"id3",eAAMPConfig_ID3Logging,false},
{true,"gstPositionQueryEnable",eAAMPConfig_EnableGstPositionQuery,false},
{false,"seekMidFragment",eAAMPConfig_MidFragmentSeek,false},
{true,"propagateUriParameters",eAAMPConfig_PropagateURIParam,false},
{true, "useWesterosSink",eAAMPConfig_UseWesterosSink,true}, // Toggle it via config based on platforms
{true,"useRetuneForUnpairedDiscontinuity",eAAMPConfig_RetuneForUnpairDiscontinuity,false},
{true,"useRetuneForGstInternalError",eAAMPConfig_RetuneForGSTError,false},
{false,"useMatchingBaseUrl",eAAMPConfig_MatchBaseUrl,false},
{false,"wifiCurlHeader",eAAMPConfig_WifiCurlHeader,false},
{false,"enableSeekableRange",eAAMPConfig_EnableSeekRange,false},
{false,"enableLiveLatencyCorrection",eAAMPConfig_EnableLiveLatencyCorrection,true},
{true,"dashParallelFragDownload",eAAMPConfig_DashParallelFragDownload,false},
{false,"persistBitrateOverSeek",eAAMPConfig_PersistentBitRateOverSeek,true},
{true,"setLicenseCaching",eAAMPConfig_SetLicenseCaching,false},
{true,"fragmp4LicensePrefetch",eAAMPConfig_FragMp4PrefetchLicense,false},
{true,"useNewABR",eAAMPConfig_ABRBufferCheckEnabled,false},
{false,"useNewAdBreaker",eAAMPConfig_NewDiscontinuity,false},
{false,"bulkTimedMetadata",eAAMPConfig_BulkTimedMetaReport,false},
{false,"bulkTimedMetadataLive",eAAMPConfig_BulkTimedMetaReportLive,false},
{false,"useAverageBandwidth",eAAMPConfig_AvgBWForABR,false},
{false,"nativeCCRendering",eAAMPConfig_NativeCCRendering,false},
{true,"subtecSubtitle",eAAMPConfig_Subtec_subtitle,false},
{true,"webVttNative",eAAMPConfig_WebVTTNative,false},
{false,"asyncTune",eAAMPConfig_AsyncTune,true},
{false,"disableUnderflow",eAAMPConfig_DisableUnderflow,false},
{true,"enableAampUnderflowMonitor",eAAMPConfig_EnableAampUnderflowMonitor,true},
{false,"limitResolution",eAAMPConfig_LimitResolution,false},
{false,"useAbsoluteTimeline",eAAMPConfig_UseAbsoluteTimeline,false},
{true,"enableAccessAttributes",eAAMPConfig_EnableAccessAttributes,false},
{false,"WideVineKIDWorkaround",eAAMPConfig_WideVineKIDWorkaround,false},
{false,"repairIframes",eAAMPConfig_RepairIframes,false},
{true,"seiTimeCode",eAAMPConfig_SEITimeCode,false},
{false,"disable4K" , eAAMPConfig_Disable4K, false},
{true,"sharedSSL",eAAMPConfig_EnableSharedSSLSession, true},
{false,"tsbInterruptHandling", eAAMPConfig_InterruptHandling,true},
{true,"enableLowLatencyDash",eAAMPConfig_EnableLowLatencyDash,true},
{true,"disableLowLatencyABR",eAAMPConfig_DisableLowLatencyABR,false},
{true,"enableLowLatencyCorrection",eAAMPConfig_EnableLowLatencyCorrection,true}, // Toggle it via config based on platforms
{true,"enableLowLatencyOffsetMin",eAAMPConfig_EnableLowLatencyOffsetMin,false},
{false,"syncAudioFragments",eAAMPConfig_SyncAudioFragments,false},
{false,"enableEosSmallFragment", eAAMPConfig_EnableIgnoreEosSmallFragment, false},
{false,"useSecManager",eAAMPConfig_UseSecManager, true},
{false,"enablePTO", eAAMPConfig_EnablePTO,false},
{true,"enableFogConfig", eAAMPConfig_EnableAampConfigToFog, false},
{DEFAULT_VALUE_GST_SUBTEC_ENABLED,"gstSubtecEnabled",eAAMPConfig_GstSubtecEnabled,false},
{true,"allowPageHeaders",eAAMPConfig_AllowPageHeaders,false},
{false,"persistHighNetworkBandwidth",eAAMPConfig_PersistHighNetworkBandwidth,false},
{true,"persistLowNetworkBandwidth",eAAMPConfig_PersistLowNetworkBandwidth,false},
{false,"changeTrackWithoutRetune", eAAMPConfig_ChangeTrackWithoutRetune, false},
{true,"curlStore", eAAMPConfig_EnableCurlStore, true},
{false,"configRuntimeDRM", eAAMPConfig_RuntimeDRMConfig,false},
{false,"enablePublishingMuxedAudio",eAAMPConfig_EnablePublishingMuxedAudio,false},
{true,"enableCMCD", eAAMPConfig_EnableCMCD, true},
{true,"SlowMotion", eAAMPConfig_EnableSlowMotion, true},
{false,"enableSCTE35PresentationTime", eAAMPConfig_EnableSCTE35PresentationTime, false},
{false,"jsinfo",eAAMPConfig_JsInfoLogging,false},
{false,"ignoreAppLiveOffset", eAAMPConfig_IgnoreAppLiveOffset, false},
{false,"useTCPServerSink",eAAMPConfig_useTCPServerSink,false},
{true,"enableDisconnectSignals", eAAMPConfig_enableDisconnectSignals, false},
{false,"sendLicenseResponseHeaders", eAAMPConfig_SendLicenseResponseHeaders, false},
{false,"suppressDecode", eAAMPConfig_SuppressDecode, false},
{false,"reconfigPipelineOnDiscontinuity", eAAMPConfig_ReconfigPipelineOnDiscontinuity, false},
{true,"enableMediaProcessor", eAAMPConfig_EnableMediaProcessor, true},
{true,"mpdStichingSupport", eAAMPConfig_MPDStitchingSupport, true}, // FIXME - spelling
{false,"sendUserAgentInLicense", eAAMPConfig_SendUserAgent, false},
{false,"enablePTSReStamp", eAAMPConfig_EnablePTSReStamp, true},
{false, "trackMemory", eAAMPConfig_TrackMemory, false},
{DEFAULT_VALUE_USE_SINGLE_PIPELINE,"useSinglePipeline", eAAMPConfig_UseSinglePipeline, false},
// ideally would be named enableEarlyId3Processing for clarity, but to avoid partner confusion leaving original spelling for now
// this will eventually be default enabled and deprecated as a configuration
{false, "earlyProcessing", eAAMPConfig_EarlyID3Processing, false},
{false, "seamlessAudioSwitch", eAAMPConfig_SeamlessAudioSwitch, true},
{false, "useRialtoSink", eAAMPConfig_useRialtoSink, false},
{false, "localTSBEnabled", eAAMPConfig_LocalTSBEnabled, true},
{false, "enableIFrameTrackExtract", eAAMPConfig_EnableIFrameTrackExtract, true},
{false, "forceMultiPeriodDiscontinuity", eAAMPConfig_ForceMultiPeriodDiscontinuity, false},
{false, "forceLLDFlow", eAAMPConfig_ForceLLDFlow, false},
{false, "monitorAV", eAAMPConfig_MonitorAV, true},
{false, "enablePTSRestampForHlsTs", eAAMPConfig_HlsTsEnablePTSReStamp, true},
{true, "overrideMediaHeaderDuration", eAAMPConfig_OverrideMediaHeaderDuration, true},
{false, "useMp4Demux", eAAMPConfig_UseMp4Demux,false },
{false, "curlThroughput", eAAMPConfig_CurlThroughput, false },
{false, "useFireboltSDK", eAAMPConfig_UseFireboltSDK, false},
{true, "enableChunkInjection", eAAMPConfig_EnableChunkInjection, true},
{false, "debugChunkTransfer", eAAMPConfig_DebugChunkTransfer, false},
{true, "utcSyncOnStartup", eAAMPConfig_UTCSyncOnStartup, true},
{false, "disableWebVTT", eAAMPConfig_DisableWebVTT, false},
{false, "enablePTSReStampLogging", eAAMPConfig_EnablePTSReStampLogging, false},
{false, "netTraceCsvDump", eAAMPConfig_NetTraceCsvDump, false},
{false, "logFilename", eAAMPConfig_LogFilename, false},
};
#define CONFIG_INT_ALIAS_COUNT 2
/**
* @brief AAMPConfigSettingInt metadata
* note that order must match the actual order of the enum; this is enforced with asserts to catch any wrong/missing declarations
*/
static const ConfigLookupEntryInt mConfigLookupTableInt[AAMPCONFIG_INT_COUNT+CONFIG_INT_ALIAS_COUNT] =
{
{0,"harvestCountLimit",eAAMPConfig_HarvestCountLimit,false},
{0,"harvestConfig",eAAMPConfig_HarvestConfig,false},
{DEFAULT_ABR_CACHE_LIFE,"abrCacheLife",eAAMPConfig_ABRCacheLife,false},
{DEFAULT_ABR_CACHE_LENGTH,"abrCacheLength",eAAMPConfig_ABRCacheLength,false},
{0,"timeShiftBufferLength",eAAMPConfig_TimeShiftBufferLength,false},
{DEFAULT_ABR_OUTLIER,"abrCacheOutlier",eAAMPConfig_ABRCacheOutlier,false},
{DEFAULT_ABR_SKIP_DURATION,"abrSkipDuration",eAAMPConfig_ABRSkipDuration,false},
{DEFAULT_ABR_NW_CONSISTENCY_CNT,"abrNwConsistency",eAAMPConfig_ABRNWConsistency,false},
{DEFAULT_AAMP_ABR_THRESHOLD_SIZE,"thresholdSizeABR",eAAMPConfig_ABRThresholdSize,false},
{DEFAULT_CACHED_FRAGMENTS_PER_TRACK,"downloadBuffer",eAAMPConfig_MaxFragmentCached,false},
{DEFAULT_BUFFER_HEALTH_MONITOR_DELAY,"bufferHealthMonitorDelay",eAAMPConfig_BufferHealthMonitorDelay,false},
{DEFAULT_BUFFER_HEALTH_MONITOR_INTERVAL,"bufferHealthMonitorInterval",eAAMPConfig_BufferHealthMonitorInterval,false},
{eDRM_PlayReady,"preferredDrm",eAAMPConfig_PreferredDRM,true,eCONFIG_RANGE_DRM_SYSTEMS},
{eTUNED_EVENT_ON_GST_PLAYING,"tuneEventConfig",eAAMPConfig_TuneEventConfig,false,eCONFIG_RANGE_TUNED_EVENT_CODE},
{TRICKPLAY_VOD_PLAYBACK_FPS,"vodTrickPlayFps",eAAMPConfig_VODTrickPlayFPS,false},
{TRICKPLAY_LINEAR_PLAYBACK_FPS,"linearTrickPlayFps",eAAMPConfig_LinearTrickPlayFPS,false},
{DEFAULT_LICENSE_REQ_RETRY_WAIT_TIME,"licenseRetryWaitTime",eAAMPConfig_LicenseRetryWaitTime,false},
{DEFAULT_LICENSE_KEY_ACQUIRE_WAIT_TIME,"licenseKeyAcquireWaitTime",eAAMPConfig_LicenseKeyAcquireWaitTime,false,eCONFIG_RANGE_LICENSE_WAIT},
{DEFAULT_PTS_ERRORS_THRESHOLD,"ptsErrorThreshold",eAAMPConfig_PTSErrorThreshold,true, eCONFIG_RANGE_PTS_ERROR_THRESHOLD },
{MAX_PLAYLIST_CACHE_SIZE,"maxPlaylistCacheSize",eAAMPConfig_MaxPlaylistCacheSize,false, eCONFIG_RANGE_PLAYLIST_CACHE_SIZE },
{MIN_DASH_DRM_SESSIONS,"dashMaxDrmSessions",eAAMPConfig_MaxDASHDRMSessions,false,eCONFIG_RANGE_DASH_DRM_SESSIONS },
{DEFAULT_WAIT_TIME_BEFORE_RETRY_HTTP_5XX_MS,"waitTimeBeforeRetryHttp5xx",eAAMPConfig_Http5XXRetryWaitInterval,false},
{0,"langCodePreference",eAAMPConfig_LanguageCodePreference,false,eCONFIG_RANGE_LANGUAGE_CODE },
{-1,"fragmentRetryLimit",eAAMPConfig_RampDownLimit,false, eCONFIG_RANGE_RAMPDOWN_LIMIT},
{0,"initRampdownLimit",eAAMPConfig_InitRampDownLimit,false},
{MAX_SEG_DRM_DECRYPT_FAIL_COUNT,"drmDecryptFailThreshold",eAAMPConfig_DRMDecryptThreshold,false,eCONFIG_RANGE_DECRYPT_ERROR_THRESHOLD },
{MAX_SEG_INJECT_FAIL_COUNT,"segmentInjectFailThreshold",eAAMPConfig_SegmentInjectThreshold,false, eCONFIG_RANGE_INJECT_ERROR_THRESHOLD },
{DEFAULT_DOWNLOAD_RETRY_COUNT,"initFragmentRetryCount",eAAMPConfig_InitFragmentRetryCount,false },
{AAMP_LOW_BUFFER_BEFORE_RAMPDOWN,"minABRBufferRampdown",eAAMPConfig_MinABRNWBufferRampDown,false},
{AAMP_HIGH_BUFFER_BEFORE_RAMPUP,"maxABRBufferRampup",eAAMPConfig_MaxABRNWBufferRampUp,false},
{DEFAULT_PREBUFFER_COUNT,"preplayBuffercount",eAAMPConfig_PrePlayBufferCount,false},
{0,"preCachePlaylistTime",eAAMPConfig_PreCachePlaylistTime,false},
{-1, "ceaFormat",eAAMPConfig_CEAPreferred,false, eCONFIG_RANGE_CEA_PREFERRED},
{DEFAULT_STALL_ERROR_CODE,"stallErrorCode",eAAMPConfig_StallErrorCode,false},
{DEFAULT_STALL_DETECTION_TIMEOUT,"stallTimeout",eAAMPConfig_StallTimeoutMS,false},
{DEFAULT_MINIMUM_INIT_CACHE_SECONDS,"initialBuffer",eAAMPConfig_InitialBuffer,false},
{DEFAULT_MAXIMUM_PLAYBACK_BUFFER_SECONDS,"playbackBuffer",eAAMPConfig_PlaybackBuffer,false},
{DEFAULT_TIMEOUT_FOR_SOURCE_SETUP,"maxTimeoutForSourceSetup",eAAMPConfig_SourceSetupTimeout,false},
{0,"downloadDelay",eAAMPConfig_DownloadDelay,false, eCONFIG_RANGE_DOWNLOAD_DELAY },
{ePAUSED_BEHAVIOR_AUTOPLAY_IMMEDIATE,"livePauseBehavior",eAAMPConfig_LivePauseBehavior,false,eCONFIG_RANGE_PAUSE_BEHAVIOR },
{MAX_GST_VIDEO_BUFFER_BYTES,"gstVideoBufBytes", eAAMPConfig_GstVideoBufBytes,true},
{MAX_GST_AUDIO_BUFFER_BYTES,"gstAudioBufBytes", eAAMPConfig_GstAudioBufBytes,true},
{DEFAULT_LATENCY_MONITOR_DELAY_MS,"latencyMonitorDelayMs",eAAMPConfig_LatencyMonitorDelayMs,false},
{DEFAULT_LATENCY_MONITOR_INTERVAL_MS,"latencyMonitorIntervalMs",eAAMPConfig_LatencyMonitorIntervalMs,false},
{DEFAULT_CACHED_FRAGMENT_CHUNKS_PER_TRACK,"downloadBufferChunks",eAAMPConfig_MaxFragmentChunkCached,false},
{DEFAULT_AAMP_ABR_CHUNK_THRESHOLD_SIZE,"abrChunkThresholdSize",eAAMPConfig_ABRChunkThresholdSize,false},
{MAX_SEG_DOWNLOAD_FAIL_COUNT,"fragmentDownloadFailThreshold",eAAMPConfig_FragmentDownloadFailThreshold,false,eCONFIG_RANGE_DOWNLOAD_ERROR_THRESHOLD },
{MAX_INIT_FRAGMENT_CACHE_PER_TRACK,"maxInitFragCachePerTrack",eAAMPConfig_MaxInitFragCachePerTrack,true, eCONFIG_RANGE_INIT_FRAGMENT_CACHE },
{FOG_MAX_CONCURRENT_DOWNLOADS,"fogMaxConcurrentDownloads",eAAMPConfig_FogMaxConcurrentDownloads, false },
{DEFAULT_CONTENT_PROTECTION_DATA_UPDATE_TIMEOUT,"contentProtectionDataUpdateTimeout",eAAMPConfig_ContentProtectionDataUpdateTimeout,false},
{MAX_CURL_SOCK_STORE,"maxCurlStore", eAAMPConfig_MaxCurlSockStore,false, eCONFIG_RANGE_CURL_SOCK_STORE_SIZE },
{6123,"TCPServerSinkPort",eAAMPConfig_TCPServerSinkPort,false, eCONFIG_RANGE_ANY },
{DEFAULT_INIT_BITRATE,"initialBitrate",eAAMPConfig_DefaultBitrate,false },
{DEFAULT_INIT_BITRATE_4K,"initialBitrate4K",eAAMPConfig_DefaultBitrate4K,false },
{0,"iframeDefaultBitrate",eAAMPConfig_IFrameDefaultBitrate,false},
{0,"iframeDefaultBitrate4K",eAAMPConfig_IFrameDefaultBitrate4K,false},
{0,"downloadStallTimeout",eAAMPConfig_CurlStallTimeout,false,eCONFIG_RANGE_TIMEOUT},
{0,"downloadStartTimeout",eAAMPConfig_CurlDownloadStartTimeout,false,eCONFIG_RANGE_TIMEOUT},
{0,"downloadLowBWTimeout",eAAMPConfig_CurlDownloadLowBWTimeout,false,eCONFIG_RANGE_TIMEOUT},
{DEFAULT_DISCONTINUITY_TIMEOUT,"discontinuityTimeout",eAAMPConfig_DiscontinuityTimeout,false},
{0,"minBitrate",eAAMPConfig_MinBitrate,true},
{INT_MAX,"maxBitrate",eAAMPConfig_MaxBitrate,true},
{CURL_SSLVERSION_TLSv1_2, "supportTLS",eAAMPConfig_TLSVersion,true,eCONFIG_RANGE_CURL_SSL_VERSION}, // minimum required version, with libcurl allowed to negotiate best version supported by client and server, typically TLS1.3
{DEFAULT_DRM_NETWORK_TIMEOUT,"drmNetworkTimeout",eAAMPConfig_DrmNetworkTimeout,true,eCONFIG_RANGE_TIMEOUT},
{0,"drmStallTimeout",eAAMPConfig_DrmStallTimeout,true,eCONFIG_RANGE_TIMEOUT},
{0,"drmStartTimeout",eAAMPConfig_DrmStartTimeout,true,eCONFIG_RANGE_TIMEOUT},
{0,"timeBasedBufferSeconds",eAAMPConfig_TimeBasedBufferSeconds,true,eCONFIG_RANGE_PLAYBACK_OFFSET},
{DEFAULT_MAX_DOWNLOAD_BUFFER,"maxDownloadBuffer",eAAMPConfig_MaxDownloadBuffer,true,eCONFIG_RANGE_PLAYBACK_OFFSET},
{DEFAULT_TELEMETRY_REPORT_INTERVAL,"telemetryInterval",eAAMPConfig_TelemetryInterval,true},
{0,"rateCorrectionDelay", eAAMPConfig_RateCorrectionDelay,true},
{-1,"harvestDuration",eAAMPConfig_HarvestDuration,false,eCONFIG_RANGE_HARVEST_DURATION},
{DEFAULT_SUBTITLE_CLOCK_SYNC_INTERVAL_S,"subtitleClockSyncInterval",eAAMPConfig_SubtitleClockSyncInterval,true},
{eABSOLUTE_PROGRESS_WITHOUT_AVAILABILITY_START,"preferredAbsoluteReporting",eAAMPConfig_PreferredAbsoluteProgressReporting,true, eCONFIG_RANGE_ABSOLUTE_REPORTING},
{EOS_INJECTION_MODE_STOP_ONLY,"EOSInjectionMode", eAAMPConfig_EOSInjectionMode,true},
{DEFAULT_ABR_BUFFER_COUNTER,"abrBufferCounter", eAAMPConfig_ABRBufferCounter,true},
{DEFAULT_TSB_DURATION,"tsbLength",eAAMPConfig_TsbLength,true},
{DEFAULT_MIN_TSB_STORAGE_FREE_PERCENTAGE,"tsbMinDiskFreePercentage",eAAMPConfig_TsbMinDiskFreePercentage,true},
{DEFAULT_MAX_TSB_STORAGE_MB,"tsbMaxDiskStorage",eAAMPConfig_TsbMaxDiskStorage,true},
{static_cast<int>(TSB::LogLevel::WARN),"tsbLog",eAAMPConfig_TsbLogLevel,false},
{DEFAULT_AD_FULFILLMENT_TIMEOUT,"adFulfillmentTimeout",eAAMPConfig_AdFulfillmentTimeout,true},
{MAX_AD_FULFILLMENT_TIMEOUT,"adFulfillmentTimeoutMax",eAAMPConfig_AdFulfillmentTimeoutMax,true},
{eDIAG_OVERLAY_NONE,"showDiagnosticsOverlay",eAAMPConfig_ShowDiagnosticsOverlay,true, eCONFIG_RANGE_SHOW_DIAGNOSTICS_OVERLAY },
{DEFAULT_MONITOR_AVSYNC_POSITIVE_DELTA_MS, "monitorAVSyncThresholdPositive", eAAMPConfig_MonitorAVSyncThresholdPositive,true, eCONFIG_RANGE_MONITOR_AVSYNC_THRESHOLD_POSITIVE },
{DEFAULT_MONITOR_AVSYNC_NEGATIVE_DELTA_MS,"monitorAVSyncThresholdNegative",eAAMPConfig_MonitorAVSyncThresholdNegative,true,eCONFIG_RANGE_MONITOR_AVSYNC_THRESHOLD_NEGATIVE },
{DEFAULT_MONITOR_AV_JUMP_THRESHOLD_MS,"monitorAVJumpThreshold",eAAMPConfig_MonitorAVJumpThreshold,true,eCONFIG_RANGE_MONITOR_AVSYNC_JUMP_THRESHOLD },
{DEFAULT_PROGRESS_LOGGING_DIVISOR,"progressLoggingDivisor",eAAMPConfig_ProgressLoggingDivisor,false},
{DEFAULT_MONITOR_AV_REPORTING_INTERVAL, "monitorAVReportingInterval", eAAMPConfig_MonitorAVReportingInterval, false},
{DEFAULT_UTC_SYNC_MIN_INTERVAL_SEC,"utcSyncMinIntervalSec",eAAMPConfig_UTCSyncMinIntervalSec,true },
{DEFAULT_ABR_BANDWIDTH_ESTIMATION_ALGORITHM, "abrBandwidthEstimator", eAAMPConfig_ABRBandwidthEstimator, false, eCONFIG_RANGE_ANY},
{DEFAULT_EARLY_ABORT_PROFILE_BANDWIDTH_PERCENT,"earlyAbortProfileBandwidthPercent",eAAMPConfig_EarlyAbortProfileBandwidthPercent,true},
// Underflow monitor polling intervals
{DEFAULT_UNDERFLOW_LOW_BUFFER_POLL_MS, "underflowLowBufferPollMs", eAAMPConfig_UnderflowLowBufferPollMs, true},
{DEFAULT_UNDERFLOW_MEDIUM_BUFFER_POLL_MS, "underflowMediumBufferPollMs", eAAMPConfig_UnderflowMediumBufferPollMs, true},
{DEFAULT_UNDERFLOW_HIGH_BUFFER_POLL_MS, "underflowHighBufferPollMs", eAAMPConfig_UnderflowHighBufferPollMs, true},
// Add new integer config entries above this line, before the aliases section.
//
// Aliases, kept for backwards compatibility
{DEFAULT_INIT_BITRATE,"defaultBitrate",eAAMPConfig_DefaultBitrate,true },
{DEFAULT_INIT_BITRATE_4K,"defaultBitrate4K",eAAMPConfig_DefaultBitrate4K,true },
};
/**
* @brief AAMPConfigSettingFloat metadata
* note that order must match the actual order of the enum; this is enforced with asserts to catch any wrong/missing declarations
*/
static const ConfigLookupEntryFloat mConfigLookupTableFloat[AAMPCONFIG_FLOAT_COUNT] =
{
{CURL_FRAGMENT_DL_TIMEOUT,"networkTimeout",eAAMPConfig_NetworkTimeout,true},
{CURL_FRAGMENT_DL_TIMEOUT,"manifestTimeout",eAAMPConfig_ManifestTimeout,true},
{0.0,"playlistTimeout",eAAMPConfig_PlaylistTimeout,true},
{DEFAULT_REPORT_PROGRESS_INTERVAL,"progressReportingInterval",eAAMPConfig_ReportProgressInterval,false},
{AAMP_DEFAULT_PLAYBACK_OFFSET,"offset",eAAMPConfig_PlaybackOffset,false,eCONFIG_RANGE_PLAYBACK_OFFSET},
{AAMP_LIVE_OFFSET,"liveOffset",eAAMPConfig_LiveOffset,true,eCONFIG_RANGE_LIVEOFFSET}, //liveOffset by user
{AAMP_DEFAULT_LIVE_OFFSET_DRIFT,"liveOffsetDriftCorrectionInterval",eAAMPConfig_LiveOffsetDriftCorrectionInterval,true,eCONFIG_RANGE_LIVEOFFSET}, //liveOffset by user
{AAMP_LIVE_OFFSET,"liveOffset4K",eAAMPConfig_LiveOffset4K,true,eCONFIG_RANGE_LIVEOFFSET}, //liveOffset for 4K by user
{AAMP_CDVR_LIVE_OFFSET,"cdvrLiveOffset",eAAMPConfig_CDVRLiveOffset,true,eCONFIG_RANGE_LIVEOFFSET},
{DEFAULT_CURL_CONNECTTIMEOUT,"connectTimeout",eAAMPConfig_Curl_ConnectTimeout,true},
{DEFAULT_DNS_CACHE_TIMEOUT,"dnsCacheTimeout",eAAMPConfig_Dns_CacheTimeout,true},
{DEFAULT_MIN_RATE_CORRECTION_SPEED,"minLatencyCorrectionPlaybackRate",eAAMPConfig_MinLatencyCorrectionPlaybackRate,false},
{DEFAULT_MAX_RATE_CORRECTION_SPEED,"maxLatencyCorrectionPlaybackRate",eAAMPConfig_MaxLatencyCorrectionPlaybackRate,false},
{DEFAULT_NORMAL_RATE_CORRECTION_SPEED,"normalLatencyCorrectionPlaybackRate",eAAMPConfig_NormalLatencyCorrectionPlaybackRate,false},
{DEFAULT_MIN_BUFFER_LOW_LATENCY,"lowLatencyMinBuffer",eAAMPConfig_LowLatencyMinBuffer,true, eCONFIG_RANGE_LLDBUFFER},
{DEFAULT_TARGET_BUFFER_LOW_LATENCY,"lowLatencyTargetBuffer",eAAMPConfig_LowLatencyTargetBuffer,true, eCONFIG_RANGE_LLDBUFFER},
{GST_BW_TO_BUFFER_FACTOR,"bandwidthToBufferFactor", eAAMPConfig_BWToGstBufferFactor,true},
// Underflow monitor thresholds (seconds)
{DEFAULT_UNDERFLOW_DETECT_THRESHOLD_SEC, "underflowDetectThresholdSec", eAAMPConfig_UnderflowDetectThresholdSec, true},
{DEFAULT_UNDERFLOW_RESUME_THRESHOLD_SEC, "underflowResumeThresholdSec", eAAMPConfig_UnderflowResumeThresholdSec, true},
{DEFAULT_UNDERFLOW_LOW_BUFFER_SEC, "underflowLowBufferSec", eAAMPConfig_UnderflowLowBufferSec, true},
{DEFAULT_UNDERFLOW_HIGH_BUFFER_SEC, "underflowHighBufferSec", eAAMPConfig_UnderflowHighBufferSec, true},
{DEFAULT_BUFFER_LEVEL_TO_ENABLE_LATENCY_SEC, "bufferLevelToEnableLatencySec", eAAMPConfig_BufferLevelToEnableCorrectionSec, false},
{DEFAULT_REBUFFER_LATENCY_STEP_SEC, "rebufferLatencyStepSec", eAAMPConfig_RebufferLatencyStepSec, false},
{DEFAULT_REBUFFER_LATENCY_MAX_INCREMENT_SEC, "rebufferLatencyMaxIncrementSec", eAAMPConfig_RebufferLatencyMaxIncrementSec, false},
{DEFAULT_LATENCY_STABLE_DURATION_SEC, "latencyStableDurationSec", eAAMPConfig_LatencyStableDurationSec, false},
{DEFAULT_LATENCY_DANGER_BUFFER_SEC, "latencyDangerBufferSec", eAAMPConfig_LatencyDangerBufferSec, false},
{DEFAULT_MIN_LOW_LATENCY, "lowLatencyMinValue", eAAMPConfig_LLMinLatency, true},
{DEFAULT_TARGET_LOW_LATENCY, "lowLatencyTargetValue", eAAMPConfig_LLTargetLatency, true},
{DEFAULT_MAX_LOW_LATENCY, "lowLatencyMaxValue", eAAMPConfig_LLMaxLatency, true}
};
/**
* @brief singleton helper class mapping configuration names to configuration metadata (not app/player instance specific)
*/
class ConfigLookup
{
private:
std::map<std::string, ConfigLookupEntryBool> lookupBool;
std::map<std::string, ConfigLookupEntryInt> lookupInt;
std::map<std::string, ConfigLookupEntryFloat> lookupFloat;
std::map<std::string, ConfigLookupEntryString> lookupString;
public:
static bool ConfigStringValueToBool( const char *value_cstr )
{
bool rc = false;
if( value_cstr )
{
if( isdigit(*value_cstr) )
{
int ival = atoi(value_cstr);
if( ival == 1 )
{
rc = true;
}
else if( ival!=0 )
{
AAMPLOG_ERR( "unexpected input: %s", value_cstr );
}
}
else if( strcasecmp(value_cstr,"true")==0 )
{
rc = true;
}
else if( strcasecmp(value_cstr,"false")!=0 )
{
AAMPLOG_ERR( "unexpected input: %s", value_cstr );
}
}
return rc;
}
void Process( AampConfig *aampConfig, ConfigPriority owner, const std::string &key, const std::string &value )
{ // used while parsing aamp.cfg text
const char *value_cstr = value.c_str();
auto iter = lookupBool.find(key);
if( iter != lookupBool.end())
{
auto cfg = iter->second;
AAMPLOG_MIL("Parsed value for dev cfg property %s - %s", key.c_str(), value_cstr );
if( value.empty() )
{
bool currentValue = aampConfig->GetConfigValue(cfg.configEnum);
aampConfig->SetConfigValue( owner, cfg.configEnum, !currentValue );
}
else
{
aampConfig->SetConfigValue( owner, cfg.configEnum, ConfigStringValueToBool(value_cstr) );
}
}
else
{
auto iter = lookupInt.find(key);
if( iter != lookupInt.end() )
{
auto cfg = iter->second;
int conv = atoi( value_cstr );
aampConfig->SetConfigValue(owner,cfg.configEnum,conv);
}
else
{
auto iter = lookupFloat.find(key);
if( iter != lookupFloat.end() )
{
auto cfg = iter->second;
double conv = atof( value_cstr );
aampConfig->SetConfigValue(owner,cfg.configEnum,conv);
}
else
{
auto iter = lookupString.find(key);
if( iter != lookupString.end() )
{
auto cfg = iter->second;
if(value.size())
{
aampConfig->SetConfigValue(owner,cfg.configEnum,value);
}
}
}
}
}
}
void Process( AampConfig *aampConfig, struct customJson &custom )
{ // called from AampConfig::CustomSearch
Process( aampConfig, customOwner, custom.config, custom.configValue );
}
void Process( AampConfig *aampConfig, cJSON *customVal, customJson &customValues, std::vector<struct customJson> &vCustom )
{ // called from AampConfig::CustomArrayRead
// Verify any of ConfigLookupEntryBool item matched with given custom json
for (auto it = lookupBool.begin(); it != lookupBool.end(); ++it)
{
const auto& keyname = it->first;
auto searchVal = cJSON_GetObjectItem(customVal,keyname.c_str());
if(searchVal)
{
customValues.config = keyname;
if(searchVal->valuestring != NULL)
{
customValues.configValue = searchVal->valuestring;
vCustom.push_back(customValues);
}
else
{
AAMPLOG_ERR("Invalid format for %s ",keyname.c_str());
continue;
}
}
}
// Verify any of ConfigLookupEntryInt item matched with given custom json
for (auto it = lookupInt.begin(); it != lookupInt.end(); ++it)
{
const auto& keyname = it->first;
auto searchVal = cJSON_GetObjectItem(customVal,keyname.c_str());
if(searchVal)
{
customValues.config = keyname;
if(searchVal->valuestring != NULL)
{
customValues.configValue = searchVal->valuestring;
vCustom.push_back(customValues);
}
else
{
AAMPLOG_ERR("Invalid format for %s ",keyname.c_str());
continue;
}
}
}
//Verify any of ConfigLookupEntryFloat item matched with given custom json
for (auto it = lookupFloat.begin(); it != lookupFloat.end(); ++it)
{
const auto& keyname = it->first;
auto searchVal = cJSON_GetObjectItem(customVal,keyname.c_str());
if(searchVal)
{
customValues.config = keyname;
if(searchVal->valuestring != NULL)
{
customValues.configValue = searchVal->valuestring;
vCustom.push_back(customValues);
}
else
{
AAMPLOG_ERR("Invalid format for %s ",keyname.c_str());
continue;
}
}
}
// Verify any of ConfigLookupEntryString item matched with given custom json
for (auto it = lookupString.begin(); it != lookupString.end(); ++it)
{
const auto& keyname = it->first;
auto searchVal = cJSON_GetObjectItem(customVal,keyname.c_str());
if(searchVal)
{
customValues.config = keyname;
if(searchVal->valuestring != NULL)
{
customValues.configValue = searchVal->valuestring;
vCustom.push_back(customValues);
}
else
{
AAMPLOG_ERR("Invalid format for %s ",keyname.c_str());
continue;
}
}
}
}
void Process( AampConfig *aampConfig, ConfigPriority owner, cJSON *searchObj )
{ // called from AampConfig::ProcessConfigJson
auto it = lookupBool.find(searchObj->string);
if( it != lookupBool.end() )
{
auto cfg = it->second;
auto cfgEnum = cfg.configEnum;
std::string keyname = it->first;
if(cJSON_IsTrue(searchObj))
{
aampConfig->SetConfigValue(owner,cfgEnum,true);
AAMPLOG_MIL("Parsed value for property %s - true",keyname.c_str());
}
else
{
aampConfig->SetConfigValue(owner,cfgEnum,false);
AAMPLOG_MIL("Parsed value for property %s - false",keyname.c_str());
}
}
else
{
auto it = lookupInt.find(searchObj->string);
if( it != lookupInt.end() )
{
auto conv = (int)searchObj->valueint;
auto cfg = it->second;
auto cfgEnum = cfg.configEnum;
std::string keyname = it->first;
aampConfig->SetConfigValue(owner,cfgEnum,conv);
AAMPLOG_MIL("Parsed value for property %s - %d",keyname.c_str(),conv);
}
else
{
auto it = lookupFloat.find(searchObj->string);
if( it != lookupFloat.end() )
{
auto conv = (double)searchObj->valuedouble;
//cJSON_GetNumberValue(searchObj)
auto cfg = it->second;
auto cfgEnum = cfg.configEnum;
std::string keyname = it->first;
aampConfig->SetConfigValue(owner,cfgEnum,conv);
AAMPLOG_MIL("Parsed value for property %s - %f",keyname.c_str(),conv);
}
else
{
auto it = lookupString.find(searchObj->string);
if( it != lookupString.end() )
{
auto conv = std::string(searchObj->valuestring);
//cJSON_GetStringValue(searchObj)
auto cfg = it->second;
auto cfgEnum = cfg.configEnum;
std::string keyname = it->first;
aampConfig->SetConfigValue(owner,cfgEnum,conv);
AAMPLOG_MIL("Parsed value for property %s - %s",keyname.c_str(),conv.c_str() );
}
}
}
}
}
ConfigLookup(): lookupBool(), lookupInt(), lookupFloat(), lookupString()
{ // constructor; populate collection of std::map for lookup by config name
int i;
assert( ARRAY_SIZE(mConfigValueValidRange) == CONFIG_RANGE_ENUM_COUNT );
for( i=0; i<CONFIG_RANGE_ENUM_COUNT; i++ )
{
assert( mConfigValueValidRange[i].type == i );
}
assert( ARRAY_SIZE(mConfigLookupTableInt) == AAMPCONFIG_INT_COUNT+CONFIG_INT_ALIAS_COUNT );
i = 0;
while( i<AAMPCONFIG_INT_COUNT )
{
assert( mConfigLookupTableInt[i].configEnum == i );
lookupInt[mConfigLookupTableInt[i].cmdString] = mConfigLookupTableInt[i];
i++;
}
while( i<ARRAY_SIZE(mConfigLookupTableInt) )
{ // two final entries with alias initialBitrate/defaultBitrate and initialBitrate4k/defaultBitrate4k
lookupInt[mConfigLookupTableInt[i].cmdString] = mConfigLookupTableInt[i];
i++;
}
assert( ARRAY_SIZE(mConfigLookupTableBool) == AAMPCONFIG_BOOL_COUNT );
for(int i=0; i<AAMPCONFIG_BOOL_COUNT; ++i)
{
assert( mConfigLookupTableBool[i].configEnum == i );
lookupBool[mConfigLookupTableBool[i].cmdString] = mConfigLookupTableBool[i];
}
assert( ARRAY_SIZE(mConfigLookupTableFloat) == AAMPCONFIG_FLOAT_COUNT );
for(int i=0; i<AAMPCONFIG_FLOAT_COUNT; ++i)
{
assert( mConfigLookupTableFloat[i].configEnum == i );
lookupFloat[mConfigLookupTableFloat[i].cmdString] = mConfigLookupTableFloat[i];
}
assert( ARRAY_SIZE(mConfigLookupTableString) == AAMPCONFIG_STRING_COUNT );
for(int i=0; i<AAMPCONFIG_STRING_COUNT; ++i)
{
assert( mConfigLookupTableString[i].configEnum == i );
lookupString[mConfigLookupTableString[i].cmdString] = mConfigLookupTableString[i];
}
}
~ConfigLookup()
{
}
};
static ConfigLookup mConfigLookup;
/////////////////// Public Functions /////////////////////////////////////
/**
* @brief AampConfig Constructor function . Default values defined
*
* @return None
*/
AampConfig::AampConfig(): mChannelOverrideMap(),vCustom(),vCustomIt(),customFound(false)
{
}
/**
* @brief AampConfig Copy Constructor function - used to update global config
*/
AampConfig& AampConfig::operator=(const AampConfig& rhs)
{
mChannelOverrideMap = rhs.mChannelOverrideMap;
vCustom = rhs.vCustom;
customFound = rhs.customFound;
memcpy(configValueBool , rhs.configValueBool , sizeof(configValueBool));
memcpy(configValueInt , rhs.configValueInt , sizeof(configValueInt));
memcpy(configValueFloat , rhs.configValueFloat , sizeof(configValueFloat));
for(int index=0;index <AAMPCONFIG_STRING_COUNT; index++)
{
configValueString[index].owner = rhs.configValueString[index].owner;
configValueString[index].lastowner = rhs.configValueString[index].lastowner;
configValueString[index].value = rhs.configValueString[index].value;
configValueString[index].lastvalue = rhs.configValueString[index].lastvalue;
}
return *this;
}
void AampConfig::Initialize()
{
for( int i=0; i<AAMPCONFIG_BOOL_COUNT; i++ )
{
configValueBool[i].value = mConfigLookupTableBool[i].defaultValue;
}
for( int i=0; i<AAMPCONFIG_INT_COUNT; i++ )
{
configValueInt[i].value = mConfigLookupTableInt[i].defaultValue;
}
for( int i=0; i<AAMPCONFIG_FLOAT_COUNT; i++ )
{
configValueFloat[i].value = mConfigLookupTableFloat[i].defaultValue;
}
for( int i=0; i<AAMPCONFIG_STRING_COUNT; i++ )
{
configValueString[i].value = mConfigLookupTableString[i].defaultValue;
}
}
void AampConfig::ApplyDeviceCapabilities()
{
std::shared_ptr<PlayerExternalsInterface> pInstance = PlayerExternalsInterface::GetPlayerExternalsInterfaceInstance();
bool IsWifiCurlHeader = pInstance->IsConfigWifiCurlHeader();
configValueBool[eAAMPConfig_UseAppSrcForProgressivePlayback].value = SocUtils::UseAppSrcForProgressivePlayback();
configValueBool[eAAMPConfig_UseWesterosSink].value = SocUtils::UseWesterosSink();
configValueBool[eAAMPConfig_SyncAudioFragments].value = SocUtils::IsAudioFragmentSyncSupported();
SetConfigValue(AAMP_DEFAULT_SETTING, eAAMPConfig_WifiCurlHeader, IsWifiCurlHeader);
bool isSecMgr = isSecManagerEnabled();
SetConfigValue(AAMP_DEFAULT_SETTING, eAAMPConfig_UseSecManager, isSecMgr);
bool isGstSubtec = SocUtils::isGstSubtecEnabled();
SetConfigValue(AAMP_DEFAULT_SETTING, eAAMPConfig_GstSubtecEnabled, isGstSubtec);
}
std::string AampConfig::GetUserAgentString() const
{
return std::string(configValueString[eAAMPConfig_UserAgent].value);
}
/**
* @brief Gets the boolean configuration value
*/
bool AampConfig::IsConfigSet(AAMPConfigSettingBool cfg) const
{ if (cfg < AAMPCONFIG_BOOL_COUNT)
{
return configValueBool[cfg].value;
}
return false;
}
bool AampConfig::GetConfigValue( AAMPConfigSettingBool cfg ) const
{
if(cfg < AAMPCONFIG_BOOL_COUNT)
{
return configValueBool[cfg].value;
}
return false;
}
/**
* @brief GetConfigValue - Gets configuration for integer data type
*
*/
int AampConfig::GetConfigValue(AAMPConfigSettingInt cfg) const
{
if(cfg < AAMPCONFIG_INT_COUNT)
{
return configValueInt[cfg].value;
}
return 0;
}
/**
* @brief GetConfigValue - Gets configuration for double data type
*
*/
double AampConfig::GetConfigValue(AAMPConfigSettingFloat cfg) const
{
if(cfg < AAMPCONFIG_FLOAT_COUNT)
{
return configValueFloat[cfg].value;
}
return 0.0;
}
/**
* @brief GetConfigValue - Gets configuration for string data type
*
*/
std::string AampConfig::GetConfigValue(AAMPConfigSettingString cfg) const
{
if(cfg < AAMPCONFIG_STRING_COUNT)
{
return configValueString[cfg].value;
}
return "";
}
/**
* @brief GetConfigOwner - Gets configuration Owner
*
* @return ConfigPriority - owner of the config
*/
ConfigPriority AampConfig::GetConfigOwner(AAMPConfigSettingBool cfg) const
{
return configValueBool[cfg].owner;
}
ConfigPriority AampConfig::GetConfigOwner(AAMPConfigSettingInt cfg) const
{
return configValueInt[cfg].owner;
}
ConfigPriority AampConfig::GetConfigOwner(AAMPConfigSettingFloat cfg) const
{
return configValueFloat[cfg].owner;
}
ConfigPriority AampConfig::GetConfigOwner(AAMPConfigSettingString cfg) const
{
return configValueString[cfg].owner;
}
/**
* @brief GetChannelOverride - Gets channel override url for channel Name
*
* @return true - if valid return
*/
const char * AampConfig::GetChannelOverride(const std::string manifestUrl) const
{
if(mChannelOverrideMap.size() && manifestUrl.size())
{
for (auto it = mChannelOverrideMap.begin(); it != mChannelOverrideMap.end(); ++it)
{
const ConfigChannelInfo &pChannelInfo = *it;
if (manifestUrl.find(pChannelInfo.name) != std::string::npos)
{
return pChannelInfo.uri.c_str();
}
}