Exemplo n.º 1
0
        private void EnterSyncBuffering(MediaType main, MediaType[] all)
        {
            // Determine if Sync-buffering can be potentially entered.
            // Entering the sync-buffering state pauses the RTC and forces the decoder make
            // components catch up with the main component.
            if (MediaCore.IsSyncBuffering || HasDisconnectedClocks || Commands.HasPendingCommands ||
                State.MediaState != MediaPlaybackState.Play || State.HasMediaEnded || Container.IsAtEndOfStream)
            {
                return;
            }

            foreach (var t in all)
            {
                if (t == MediaType.Subtitle || t == main)
                {
                    continue;
                }

                // We don't want to sync-buffer on attached pictures
                if (Container.Components[t].IsStillPictures)
                {
                    continue;
                }

                // If we have data on the t component beyond the start time of the main
                // we don't need to enter sync-buffering.
                if (MediaCore.Blocks[t].RangeEndTime >= MediaCore.Blocks[main].RangeStartTime)
                {
                    continue;
                }

                // If we are not in range of the non-main component we need to
                // enter sync-buffering
                MediaCore.SignalSyncBufferingEntered();
                return;
            }
        }