VirtualBox

Changeset 75076 in vbox for trunk/src/VBox/Main/src-client


Ignore:
Timestamp:
Oct 25, 2018 2:42:55 PM (6 years ago)
Author:
vboxsync
Message:

VideoRec/WebMWriter: Use the block map's currently processed TC (timecode) as the new cluster's starting TC.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/WebMWriter.cpp

    r75048 r75076  
    647647        }
    648648
    649         /* No blocks written yet? Start a new cluster. */
    650         if (Cluster.cBlocks == 0)
     649        /* Determine if we need to start a new cluster. */
     650            /* No blocks written yet? Start a new cluster. */
     651        if (   Cluster.cBlocks == 0
     652            /* Did we reach the maximum a cluster can hold? Use a new cluster then. */
     653            || mapAbsPTSMs - Cluster.tcAbsStartMs > VBOX_WEBM_CLUSTER_MAX_LEN_MS
     654            /* If the block map indicates that a cluster is needed for this timecode, create one. */
     655            || mapBlocks.fClusterNeeded)
     656        {
    651657            fClusterStart = true;
    652 
    653         /* Did we reach the maximum a cluster can hold? Use a new cluster then. */
    654         if (mapAbsPTSMs - Cluster.tcAbsStartMs > VBOX_WEBM_CLUSTER_MAX_LEN_MS)
    655             fClusterStart = true;
    656 
    657         /* If the block map indicates that a cluster is needed for this timecode, create one. */
    658         if (mapBlocks.fClusterNeeded)
    659             fClusterStart = true;
     658        }
    660659
    661660        if (   fClusterStart
     
    683682                tcAbsClusterLastWrittenMs = CurSeg.tcAbsStartMs;
    684683
    685             Assert(tcAbsClusterLastWrittenMs >= CurSeg.tcAbsStartMs);
    686 
    687684            Cluster.fOpen              = true;
    688685            Cluster.uID                = CurSeg.cClusters;
    689             /* Use the last written timecode of the former cluster as starting point. */
    690             Cluster.tcAbsStartMs       = tcAbsClusterLastWrittenMs;
     686            /* Use the block map's currently processed TC as the cluster's starting TC. */
     687            Cluster.tcAbsStartMs       = mapAbsPTSMs;
    691688            Cluster.tcAbsLastWrittenMs = Cluster.tcAbsStartMs;
    692689            Cluster.offStart           = RTFileTell(getFile());
    693690            Cluster.cBlocks            = 0;
     691
     692            AssertMsg(Cluster.tcAbsStartMs <= mapAbsPTSMs,
     693                      ("Cluster #%RU64 start TC (%RU64) must not bigger than the block map's currently processed TC (%RU64)\n",
     694                       Cluster.uID, Cluster.tcAbsStartMs, mapAbsPTSMs));
    694695
    695696            Log2Func(("[C%RU64] Start @ %RU64ms (map TC is %RU64) / %RU64 bytes\n",
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette