Menu

[r28]: / libs / OSMF / org / osmf / net / httpstreaming / f4f / HTTPStreamingF4FIndexHandler.as  Maximize  Restore  History

Download this file

774 lines (691 with data), 22.7 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
/*****************************************************
*
* Copyright 2009 Adobe Systems Incorporated. All Rights Reserved.
*
*****************************************************
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
*
* The Initial Developer of the Original Code is Adobe Systems Incorporated.
* Portions created by Adobe Systems Incorporated are Copyright (C) 2009 Adobe Systems
* Incorporated. All Rights Reserved.
*
*****************************************************/
package org.osmf.net.httpstreaming.f4f
{
import __AS3__.vec.Vector;
import flash.net.URLRequest;
import flash.utils.ByteArray;
import org.osmf.elements.f4mClasses.BootstrapInfo;
import org.osmf.events.DVRStreamInfoEvent;
import org.osmf.events.HTTPStreamingFileHandlerEvent;
import org.osmf.events.HTTPStreamingIndexHandlerEvent;
import org.osmf.net.dvr.DVRUtils;
import org.osmf.net.httpstreaming.HTTPStreamRequest;
import org.osmf.net.httpstreaming.HTTPStreamingFileHandlerBase;
import org.osmf.net.httpstreaming.HTTPStreamingIndexHandlerBase;
import org.osmf.net.httpstreaming.flv.FLVTagScriptDataObject;
CONFIG::LOGGING
{
import org.osmf.logging.Logger;
}
[ExcludeClass]
/**
* @private
*
* The actual implementation of HTTPStreamingFileIndexHandlerBase. It
* handles the indexing scheme of an F4V file.
*/
public class HTTPStreamingF4FIndexHandler extends HTTPStreamingIndexHandlerBase
{
/**
* Constructor.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function HTTPStreamingF4FIndexHandler(fileHandler:HTTPStreamingFileHandlerBase, fragmentsThreshold:uint = DEFAULT_FRAGMENTS_THRESHOLD)
{
super();
currentQuality = -1;
currentFAI = null;
fragmentRunTablesUpdating = false;
this.fileHandler = fileHandler;
this.fragmentsThreshold = fragmentsThreshold;
dvrGetStreamInfoCall = false;
fileHandler.addEventListener(HTTPStreamingFileHandlerEvent.NOTIFY_BOOTSTRAP_BOX, onNewBootstrapBox);
}
/**
* @private
*/
public function get bootstrapInfo():AdobeBootstrapBox
{
return currentQuality < 0? null : bootstrapBoxes[currentQuality];
}
/**
* @private
*/
override public function dvrGetStreamInfo(indexInfo:Object):void
{
dvrGetStreamInfoCall = true;
playInProgress = false;
initialize(indexInfo);
}
/**
* @private
*/
override public function initialize(indexInfo:Object):void
{
// Make sure we have an info object of the expected type.
f4fIndexInfo = indexInfo as HTTPStreamingF4FIndexInfo;
if (f4fIndexInfo == null || f4fIndexInfo.streamInfos == null || f4fIndexInfo.streamInfos.length <= 0)
{
dispatchEvent(new HTTPStreamingIndexHandlerEvent(HTTPStreamingIndexHandlerEvent.NOTIFY_ERROR));
return;
}
bootstrapBoxes = new Vector.<AdobeBootstrapBox>(f4fIndexInfo.streamInfos.length);
fragmentRunTablesUpdating= false;
playInProgress = false;
pendingIndexLoads = 0;
pureLiveOffset = NaN;
serverBaseURL = f4fIndexInfo.serverBaseURL;
streamInfos = f4fIndexInfo.streamInfos;
var bootstrapBox:AdobeBootstrapBox;
for (var i:int = 0; i < streamInfos.length; i++)
{
var bootstrap:BootstrapInfo = streamInfos[i].bootstrapInfo;
if (bootstrap == null || (bootstrap.url == null && bootstrap.data == null))
{
dispatchEvent(new HTTPStreamingIndexHandlerEvent(HTTPStreamingIndexHandlerEvent.NOTIFY_ERROR));
return;
}
if (bootstrap.data != null)
{
bootstrapBox = processBootstrapData(bootstrap.data, null);
if (bootstrapBox == null)
{
dispatchEvent(new HTTPStreamingIndexHandlerEvent(HTTPStreamingIndexHandlerEvent.NOTIFY_ERROR));
return;
}
bootstrapBoxes[i] = bootstrapBox;
}
else
{
pendingIndexLoads++;
dispatchEvent
( new HTTPStreamingIndexHandlerEvent
( HTTPStreamingIndexHandlerEvent.REQUEST_LOAD_INDEX
, false
, false
, false
, NaN
, null
, null
, new URLRequest(bootstrap.url)
, i
, true
)
);
}
}
if (pendingIndexLoads == 0)
{
dispatchEvent
( new HTTPStreamingIndexHandlerEvent
( HTTPStreamingIndexHandlerEvent.NOTIFY_RATES
, false
, false
, false
, NaN
, getStreamNames(streamInfos)
, getQualityRates(streamInfos)
)
);
notifyIndexReady(0);
}
}
/**
* @private
*/
override public function processIndexData(data:*, indexContext:Object):void
{
var index:int = indexContext as int;
var bootstrapBox:AdobeBootstrapBox = processBootstrapData(data, index);
CONFIG::LOGGING
{
logger.debug("processIndexData: " + index + " pendingIndexUpdates: " + pendingIndexUpdates);
logger.debug("abst version: " + bootstrapBox.bootstrapVersion +
" fragments calculated: " + bootstrapBox.totalFragments +
" fragments from segment run table: " + bootstrapBox.segmentRunTables[0].totalFragments);
}
if (bootstrapBox == null)
{
dispatchEvent(new HTTPStreamingIndexHandlerEvent(HTTPStreamingIndexHandlerEvent.NOTIFY_ERROR));
return;
}
if (!fragmentRunTablesUpdating)
{
pendingIndexLoads--;
}
else
{
pendingIndexUpdates--;
if (pendingIndexUpdates == 0)
{
fragmentRunTablesUpdating = false;
notifyTotalDuration(bootstrapBox.totalDuration / bootstrapBox.timeScale, indexContext as int);
dispatchDVRStreamInfo(bootstrapBox);
}
}
if (bootstrapBoxes[index] == null ||
bootstrapBoxes[index].bootstrapVersion < bootstrapBox.bootstrapVersion ||
bootstrapBoxes[index].currentMediaTime < bootstrapBox.currentMediaTime)
{
delay = 0.05;
bootstrapBoxes[index] = bootstrapBox;
}
if (pendingIndexLoads == 0 && !fragmentRunTablesUpdating)
{
dispatchEvent
( new HTTPStreamingIndexHandlerEvent
( HTTPStreamingIndexHandlerEvent.NOTIFY_RATES
, false
, false
, false
, NaN
, getStreamNames(streamInfos)
, getQualityRates(streamInfos)
)
);
notifyIndexReady(index);
}
}
/**
* @private
*/
override public function getFileForTime(time:Number, quality:int):HTTPStreamRequest
{
var abst:AdobeBootstrapBox = bootstrapBoxes[quality];
var streamRequest:HTTPStreamRequest = null;
if (!playInProgress && stopPlaying(abst))
{
return null;
}
checkMetadata(quality, abst);
var frt:AdobeFragmentRunTable = getFragmentRunTable(abst);
if ( time >= 0
&& time * abst.timeScale <= abst.currentMediaTime
&& quality >= 0
&& quality < streamInfos.length
)
{
currentFAI = frt.findFragmentIdByTime(
time * abst.timeScale, abst.currentMediaTime, abst.contentComplete()? false : abst.live);
if (currentFAI == null || fragmentOverflow(abst, currentFAI.fragId))
{
if (abst.contentComplete())
{
if (abst.live) // live/DVR playback stops
{
return new HTTPStreamRequest(null, quality, -1, -1, true);
}
else
{
return null;
}
}
else
{
adjustDelay();
refreshBootstrapInfo(quality);
return new HTTPStreamRequest(null, quality, 0, delay);
}
}
playInProgress = true;
var fdp:FragmentDurationPair = frt.fragmentDurationPairs[0];
var segId:uint = abst.findSegmentId(currentFAI.fragId - fdp.firstFragment + 1);
var requestUrl:String = "";
if ((streamInfos[quality].streamName as String).indexOf("http") != 0)
{
requestUrl = serverBaseURL + "/" + streamInfos[quality].streamName + "Seg" + segId + "-Frag" + currentFAI.fragId;
}
else
{
requestUrl = streamInfos[quality].streamName + "Seg" + segId + "-Frag" + currentFAI.fragId;
}
CONFIG::LOGGING
{
logger.debug("getFileForTime URL = " + requestUrl);
}
streamRequest = new HTTPStreamRequest(requestUrl);
checkQuality(quality);
notifyFragmentDuration(currentFAI.fragDuration / abst.timeScale);
}
CONFIG::LOGGING
{
if (streamRequest == null)
{
logger.debug("getFileForTime No URL for time=" + time + " and quality=" + quality);
}
}
return streamRequest;
}
/**
* @private
*/
override public function getNextFile(quality:int):HTTPStreamRequest
{
var abst:AdobeBootstrapBox = bootstrapBoxes[quality];
var streamRequest:HTTPStreamRequest = null;
/*
if (quality != this.currentQuality)
{
var curAbst:AdobeBootstrapBox = bootstrapBoxes[currentQuality];
if (currentFAI == null || (currentFAI.fragmentEndTime*abst.timeScale/curAbst.timeScale > abst.currentMediaTime))
{
adjustDelay();
refreshBootstrapInfo(quality);
return new HTTPStreamRequest(null, quality, 0, delay);
}
return getFileForTime(currentFAI.fragmentEndTime / curAbst.timeScale, quality);
}
*/
if (!playInProgress && stopPlaying(abst))
{
return null;
}
checkMetadata(quality, abst);
if (quality >= 0 && quality < streamInfos.length)
{
var frt:AdobeFragmentRunTable = getFragmentRunTable(abst);
var oldCurrentFAI:FragmentAccessInformation = currentFAI;
currentFAI = frt.validateFragment(currentFAI.fragId + 1, abst.currentMediaTime, abst.contentComplete()? false : abst.live);
if (currentFAI == null || fragmentOverflow(abst, currentFAI.fragId))
{
if (!abst.live || abst.contentComplete())
{
if (abst.live) // live/DVR playback stops
{
return new HTTPStreamRequest(null, quality, -1, -1, true);
}
else
{
return null;
}
}
else
{
adjustDelay();
currentFAI = oldCurrentFAI;
refreshBootstrapInfo(quality);
return new HTTPStreamRequest(null, quality, 0, delay);
}
}
playInProgress = true;
var fdp:FragmentDurationPair = frt.fragmentDurationPairs[0];
var segId:uint = abst.findSegmentId(currentFAI.fragId - fdp.firstFragment + 1);
var requestUrl:String = "";
if ((streamInfos[quality].streamName as String).indexOf("http") != 0)
{
requestUrl = serverBaseURL + "/" + streamInfos[quality].streamName + "Seg" + segId + "-Frag" + currentFAI.fragId;
}
else
{
requestUrl = streamInfos[quality].streamName + "Seg" + segId + "-Frag" + currentFAI.fragId;
}
streamRequest = new HTTPStreamRequest(requestUrl);
checkQuality(quality);
notifyFragmentDuration(currentFAI.fragDuration / abst.timeScale);
CONFIG::LOGGING
{
logger.debug("getNextFile URL = " + requestUrl);
}
}
CONFIG::LOGGING
{
if (streamRequest == null)
{
logger.debug("getNextFile No URL for quality=" + quality);
}
}
return streamRequest;
}
/**
* @private
*
* Given timeBias, calculates the corresponding segment duration.
*/
internal function calculateSegmentDuration(abst:AdobeBootstrapBox, timeBias:Number):Number
{
var fragmentDurationPairs:Vector.<FragmentDurationPair> = (abst.fragmentRunTables)[0].fragmentDurationPairs;
var fragmentId:uint = currentFAI.fragId;
var index:int = fragmentDurationPairs.length - 1;
while (index >= 0)
{
var fragmentDurationPair:FragmentDurationPair = fragmentDurationPairs[index];
if (fragmentDurationPair.firstFragment <= fragmentId)
{
var duration:Number = fragmentDurationPair.duration;
var durationAccrued:Number = fragmentDurationPair.durationAccrued;
durationAccrued += (fragmentId - fragmentDurationPair.firstFragment) * fragmentDurationPair.duration;
if (timeBias > 0)
{
duration -= (timeBias - durationAccrued);
}
return duration;
}
else
{
index--;
}
}
return 0;
}
// Internal
//
/**
* When there is an MBR switching and the switched-to fragment is DRM protected,
* we need to append the additionalHeader that contains the DRM metadata to the Flash Player
* for that fragment before any additional TCMessage can be appended to FP.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
private function checkQuality(quality:int):void
{
if (currentQuality != quality)
{
var prevAdditionalHeader:ByteArray = (currentQuality < 0)? null : streamInfos[currentQuality].additionalHeader;
currentQuality = quality;
var newAdditionalHeader:ByteArray = streamInfos[currentQuality].additionalHeader;
// Strictly speaking, the != comparison of additional header is not enough.
// Ideally, we need to do bytewise comparison, however there might be a performance
// hit considering the size of the additional header.
if (newAdditionalHeader != prevAdditionalHeader && newAdditionalHeader != null)
{
var flvTag:FLVTagScriptDataObject = new FLVTagScriptDataObject();
flvTag.data = newAdditionalHeader;
dispatchEvent
( new HTTPStreamingIndexHandlerEvent
( HTTPStreamingIndexHandlerEvent.NOTIFY_SCRIPT_DATA
, false
, false
, false
, NaN
, null
, null
, null
, null
, true
, 0
, flvTag
, true
, false
)
);
}
}
}
private function checkMetadata(quality:int, abst:AdobeBootstrapBox):void
{
if (currentQuality != quality)
{
notifyTotalDuration(abst.totalDuration / abst.timeScale, quality);
}
}
private function refreshBootstrapInfo(quality:uint):void
{
pendingIndexUpdates++;
fragmentRunTablesUpdating = true;
CONFIG::LOGGING
{
logger.debug("refresh frt: " + (streamInfos[quality] as HTTPStreamingF4FStreamInfo).bootstrapInfo.url);
}
dispatchEvent
( new HTTPStreamingIndexHandlerEvent
( HTTPStreamingIndexHandlerEvent.REQUEST_LOAD_INDEX
, false
, false
, false
, NaN
, null
, null
, new URLRequest((streamInfos[quality] as HTTPStreamingF4FStreamInfo).bootstrapInfo.url)
, quality
, true
)
);
}
private function processBootstrapData(data:*, indexContext:Object):AdobeBootstrapBox
{
var bootstrapBox:AdobeBootstrapBox = null;
var parser:BoxParser = new BoxParser();
data.position = 0;
parser.init(data);
try
{
var boxes:Vector.<Box> = parser.getBoxes();
}
catch (e:Error)
{
boxes = null;
}
if (boxes == null || boxes.length < 1)
{
return null;
}
bootstrapBox = boxes[0] as AdobeBootstrapBox;
if (bootstrapBox == null)
{
return null;
}
if (serverBaseURL == null || serverBaseURL.length <= 0)
{
if (bootstrapBox.serverBaseURLs == null || bootstrapBox.serverBaseURLs.length <= 0)
{
// If serverBaseURL is not set from the external, we need to pick
// a server base URL from the bootstrap box. For now, we just
// pick the first one. It is an error if the server base URL is null
// under this circumstance.
return null;
}
}
return bootstrapBox;
}
private function getQualityRates(streamInfos:Vector.<HTTPStreamingF4FStreamInfo>):Array
{
var rates:Array = [];
if (streamInfos.length >= 1)
{
for (var i:int = 0; i < streamInfos.length; i++)
{
var streamInfo:HTTPStreamingF4FStreamInfo = streamInfos[i] as HTTPStreamingF4FStreamInfo;
rates.push(streamInfo.bitrate);
}
}
return rates;
}
private function getStreamNames(streamInfos:Vector.<HTTPStreamingF4FStreamInfo>):Array
{
var streamNames:Array = [];
if (streamInfos.length >= 1)
{
for (var i:int = 0; i < streamInfos.length; i++)
{
var streamInfo:HTTPStreamingF4FStreamInfo = streamInfos[i] as HTTPStreamingF4FStreamInfo;
streamNames.push(streamInfo.streamName);
}
}
return streamNames;
}
private function getFragmentRunTable(abst:AdobeBootstrapBox):AdobeFragmentRunTable
{
// For now, we assume that there is only one fragment run table.
return abst.fragmentRunTables[0];
}
private function notifyTotalDuration(duration:Number, quality:int):void
{
var sdo:FLVTagScriptDataObject = new FLVTagScriptDataObject();
var metaInfo:Object = this.f4fIndexInfo.streamInfos[quality].streamMetadata;
if (metaInfo == null)
{
metaInfo = new Object();
}
metaInfo.duration = duration;
sdo.objects = ["onMetaData", metaInfo];
dispatchEvent
( new HTTPStreamingIndexHandlerEvent
( HTTPStreamingIndexHandlerEvent.NOTIFY_SCRIPT_DATA
, false
, false
, false
, NaN
, null
, null
, null
, null
, false
, 0
, sdo
, false
, true
)
);
}
private function notifyFragmentDuration(duration:Number):void
{
dispatchEvent
( new HTTPStreamingIndexHandlerEvent
( HTTPStreamingIndexHandlerEvent.NOTIFY_SEGMENT_DURATION
, false
, false
, false
, NaN
, null
, null
, null
, null
, true
, duration
)
);
}
private function notifyIndexReady(quality:int):void
{
var abst:AdobeBootstrapBox = bootstrapBoxes[quality];
var frt:AdobeFragmentRunTable = getFragmentRunTable(abst);
dispatchDVRStreamInfo(abst);
if (!dvrGetStreamInfoCall)
{
if (abst.live && f4fIndexInfo.dvrInfo == null && isNaN(pureLiveOffset))
{
pureLiveOffset = (abst.currentMediaTime - offsetFromCurrent * abst.timeScale) > 0? abst.currentMediaTime / abst.timeScale - offsetFromCurrent : NaN
}
dispatchEvent
( new HTTPStreamingIndexHandlerEvent
( HTTPStreamingIndexHandlerEvent.NOTIFY_INDEX_READY
, false
, false
, abst.live
, pureLiveOffset
)
);
}
dvrGetStreamInfoCall = false;
}
private function stopPlaying(abst:AdobeBootstrapBox):Boolean
{
var frt:AdobeFragmentRunTable = getFragmentRunTable(abst);
if ((f4fIndexInfo.dvrInfo == null && abst.live && frt.tableComplete()) ||
(f4fIndexInfo.dvrInfo != null && f4fIndexInfo.dvrInfo.offline))
{
return true;
}
return false;
}
private function onNewBootstrapBox(event:HTTPStreamingFileHandlerEvent):void
{
var abst:AdobeBootstrapBox = bootstrapBoxes[currentQuality];
if (abst.bootstrapVersion < event.bootstrapBox.bootstrapVersion ||
abst.currentMediaTime < event.bootstrapBox.currentMediaTime)
{
bootstrapBoxes[currentQuality] = event.bootstrapBox;
dispatchDVRStreamInfo(event.bootstrapBox);
}
}
private function dispatchDVRStreamInfo(abst:AdobeBootstrapBox):void
{
var frt:AdobeFragmentRunTable = getFragmentRunTable(abst);
if (f4fIndexInfo.dvrInfo != null)
{
f4fIndexInfo.dvrInfo.isRecording = !frt.tableComplete();
if (isNaN(f4fIndexInfo.dvrInfo.startTime))
{
f4fIndexInfo.dvrInfo.startTime =
frt.tableComplete()? 0 : DVRUtils.calculateOffset(
((f4fIndexInfo.dvrInfo.beginOffset < 0) || isNaN(f4fIndexInfo.dvrInfo.beginOffset))? 0 : f4fIndexInfo.dvrInfo.beginOffset,
((f4fIndexInfo.dvrInfo.endOffset < 0) || isNaN(f4fIndexInfo.dvrInfo.endOffset))? 0 : f4fIndexInfo.dvrInfo.endOffset,
abst.totalDuration/abst.timeScale);
f4fIndexInfo.dvrInfo.startTime += (frt.fragmentDurationPairs)[0].durationAccrued/abst.timeScale;
if (f4fIndexInfo.dvrInfo.startTime > abst.currentMediaTime)
{
f4fIndexInfo.dvrInfo.startTime = abst.currentMediaTime;
}
}
f4fIndexInfo.dvrInfo.curLength = abst.currentMediaTime/abst.timeScale - f4fIndexInfo.dvrInfo.startTime;
dispatchEvent(new DVRStreamInfoEvent(DVRStreamInfoEvent.DVRSTREAMINFO, false, false, f4fIndexInfo.dvrInfo));
}
}
private function fragmentOverflow(abst:AdobeBootstrapBox, fragId:uint):Boolean
{
var fragmentRunTable:AdobeFragmentRunTable = abst.fragmentRunTables[0];
var fdp:FragmentDurationPair = fragmentRunTable.fragmentDurationPairs[0];
var segmentRunTable:AdobeSegmentRunTable = abst.segmentRunTables[0];
return ((segmentRunTable == null) || ((segmentRunTable.totalFragments + fdp.firstFragment - 1) < fragId));
}
private function adjustDelay():void
{
if (delay < 1.0)
{
delay = delay * 2.0;
if (delay > 1.0)
{
delay = 1.0;
}
}
}
private var pendingIndexLoads:int;
private var pendingIndexUpdates:int;
private var bootstrapBoxes:Vector.<AdobeBootstrapBox>;
private var serverBaseURL:String;
private var streamInfos:Vector.<HTTPStreamingF4FStreamInfo>;
private var currentQuality:int;
private var currentFAI:FragmentAccessInformation;
private var fragmentsThreshold:uint;
private var fragmentRunTablesUpdating:Boolean;
private var f4fIndexInfo:HTTPStreamingF4FIndexInfo;
private var fileHandler:HTTPStreamingFileHandlerBase;
private var dvrGetStreamInfoCall:Boolean;
private var playInProgress:Boolean;
private var offsetFromCurrent:Number = 5;
private var delay:Number = 0.05;
private var pureLiveOffset:Number = NaN;
public static const DEFAULT_FRAGMENTS_THRESHOLD:uint = 5;
CONFIG::LOGGING
{
private static const logger:org.osmf.logging.Logger = org.osmf.logging.Log.getLogger("org.osmf.net.httpstreaming.HTTPStreamF4FIndexHandler");
}
}
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.