Changeset 75041 in vbox
- Timestamp:
- Oct 24, 2018 1:57:34 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 126084
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/WebMWriter.h
r75033 r75041 363 363 /** Absolute timecode (in ms) when this cluster starts. */ 364 364 WebMTimecodeAbs tcAbsStartMs; 365 /** Absolute timecode (in ms) of when last written to this cluster. */ 366 WebMTimecodeAbs tcAbsLastWrittenMs; 365 367 /** Number of (simple) blocks in this cluster. */ 366 368 uint64_t cBlocks; -
trunk/src/VBox/Main/src-client/WebMWriter.cpp
r75031 r75041 441 441 const WebMTimecodeAbs tcAbsPTS = a_pBlock->Data.tcAbsPTSMs; 442 442 443 /* Check if the current segment already has been started.444 * If not, use the current (absolute) time stamp for it. */445 if (CurSeg.tcAbsStartMs == 0)446 {447 CurSeg.tcAbsStartMs = tcAbsPTS;448 LogFunc(("Segment started @ %RU64ms\n", CurSeg.tcAbsStartMs));449 }450 451 443 /* See if we already have an entry for the specified timecode in our queue. */ 452 444 WebMBlockMap::iterator itQueue = CurSeg.queueBlocks.Map.find(tcAbsPTS); … … 464 456 } 465 457 466 processQueue(&CurSeg.queueBlocks, false /* fForce */);458 rc = processQueue(&CurSeg.queueBlocks, false /* fForce */); 467 459 } 468 460 catch(...) … … 496 488 && tcAbsPTSMs <= a_pTrack->tcAbsLastWrittenMs) 497 489 { 490 AssertFailed(); /* Should never happen. */ 498 491 tcAbsPTSMs = a_pTrack->tcAbsLastWrittenMs + 1; 499 492 } … … 646 639 bool fClusterStart = false; 647 640 641 /* If the current segment does not have any clusters (yet), 642 * take the first absolute PTS as the starting point for that segment. */ 643 if (CurSeg.cClusters == 0) 644 { 645 CurSeg.tcAbsStartMs = mapAbsPTSMs; 646 fClusterStart = true; 647 } 648 648 649 /* No blocks written yet? Start a new cluster. */ 649 650 if (Cluster.cBlocks == 0) … … 661 662 && !mapBlocks.fClusterStarted) 662 663 { 664 /* Last written timecode of the current cluster. */ 665 uint64_t tcAbsClusterLastWrittenMs; 666 663 667 if (Cluster.fOpen) /* Close current cluster first. */ 664 668 { 665 /* Make sure that the current cluster contained some data. */ 669 Log2Func(("[C%RU64] End @ %RU64ms (duration = %RU64ms)\n", 670 Cluster.uID, Cluster.tcAbsLastWrittenMs, Cluster.tcAbsLastWrittenMs - Cluster.tcAbsStartMs)); 671 672 /* Make sure that the current cluster contained some data. */ 666 673 Assert(Cluster.offStart); 667 674 Assert(Cluster.cBlocks); 675 676 /* Save the last written timecode of the current cluster before closing it. */ 677 tcAbsClusterLastWrittenMs = Cluster.tcAbsLastWrittenMs; 668 678 669 679 subEnd(MkvElem_Cluster); 670 680 Cluster.fOpen = false; 671 681 } 672 673 Cluster.fOpen = true; 674 Cluster.uID = CurSeg.cClusters; 675 Cluster.tcAbsStartMs = mapAbsPTSMs; 676 Cluster.offStart = RTFileTell(getFile()); 677 Cluster.cBlocks = 0; 682 else /* First cluster ever? Use the segment's starting timecode. */ 683 tcAbsClusterLastWrittenMs = CurSeg.tcAbsStartMs; 684 685 Assert(tcAbsClusterLastWrittenMs >= CurSeg.tcAbsStartMs); 686 687 Cluster.fOpen = true; 688 Cluster.uID = CurSeg.cClusters; 689 /* Use the last written timecode of the former cluster as starting point. */ 690 Cluster.tcAbsStartMs = tcAbsClusterLastWrittenMs; 691 Cluster.tcAbsLastWrittenMs = Cluster.tcAbsStartMs; 692 Cluster.offStart = RTFileTell(getFile()); 693 Cluster.cBlocks = 0; 678 694 679 695 Log2Func(("[C%RU64] Start @ %RU64ms (map TC is %RU64) / %RU64 bytes\n", … … 693 709 694 710 subStart(MkvElem_Cluster) 695 .serializeUnsignedInteger(MkvElem_Timecode, Cluster.tcAbsStartMs );711 .serializeUnsignedInteger(MkvElem_Timecode, Cluster.tcAbsStartMs - CurSeg.tcAbsStartMs); 696 712 697 713 CurSeg.cClusters++; … … 699 715 mapBlocks.fClusterStarted = true; 700 716 } 717 718 Log2Func(("[C%RU64] SegTcAbsStartMs=%RU64, ClusterTcAbsStartMs=%RU64, ClusterTcAbsLastWrittenMs=%RU64, mapAbsPTSMs=%RU64\n", 719 Cluster.uID, CurSeg.tcAbsStartMs, Cluster.tcAbsStartMs, Cluster.tcAbsLastWrittenMs, mapAbsPTSMs)); 701 720 702 721 /* Iterate through all blocks related to the current timecode. */ … … 717 736 718 737 Cluster.cBlocks++; 738 Cluster.tcAbsLastWrittenMs = pBlock->Data.tcAbsPTSMs; 719 739 720 740 pTrack->cTotalBlocks++; 721 pTrack->tcAbsLastWrittenMs = pBlock->Data.tcAbsPTSMs;741 pTrack->tcAbsLastWrittenMs = Cluster.tcAbsLastWrittenMs; 722 742 723 743 if (CurSeg.tcAbsLastWrittenMs < pTrack->tcAbsLastWrittenMs) … … 730 750 { 731 751 /* Insert cue points for all tracks if a new cluster has been started. */ 732 WebMCuePoint *pCuePoint = new WebMCuePoint(C urSeg.tcAbsLastWrittenMs);752 WebMCuePoint *pCuePoint = new WebMCuePoint(Cluster.tcAbsLastWrittenMs); 733 753 734 754 WebMTracks::iterator itTrack = CurSeg.mapTracks.begin(); … … 847 867 CurSeg.offSeekInfo = RTFileTell(getFile()); 848 868 849 LogFunc(("Seek Heade der @ %RU64\n", CurSeg.offSeekInfo));869 LogFunc(("Seek Header @ %RU64\n", CurSeg.offSeekInfo)); 850 870 851 871 subStart(MkvElem_SeekHead);
Note:
See TracChangeset
for help on using the changeset viewer.