コード例 #1
0
ファイル: TestRunner.cs プロジェクト: forestrf/AlantaMedia
        protected virtual void RunAllTests()
        {
            var videoChunkPool = new ObjectPool <ByteStream>(() => new ByteStream(VideoConstants.MaxPayloadSize * 2), bs => bs.Reset());

            for (int noSendCutoff = NoSendStart; noSendCutoff <= NoSendStop; noSendCutoff += NoSendStep)
            {
                for (int deltaSendCutoff = DeltaSendStart; deltaSendCutoff <= DeltaSendStop; deltaSendCutoff += DeltaSendStep)
                {
                    for (short jpegQuality = JpegQualityStart; jpegQuality <= JpegQualityStop; jpegQuality += JpegQualityStep)
                    {
                        if (mStopRequested)
                        {
                            return;
                        }
                        if (deltaSendCutoff < noSendCutoff)
                        {
                            break;
                        }
                        var vqc = new TestVideoQualityController
                        {
                            NoSendCutoff    = noSendCutoff,
                            DeltaSendCutoff = deltaSendCutoff,
                            JpegQuality     = (byte)jpegQuality,
                        };
                        OnUi(() => Status = string.Format("Executing test for NoSendCutoff {0}; DeltaSendCutoff {1}; JpegQuality {2}", vqc.NoSendCutoff, vqc.DeltaSendCutoff, vqc.JpegQuality));
                        var videoCodec = mCodecFunction(vqc);
                        var test       = new TestInstance(vqc, videoCodec, RawFrames, new List <byte[]>(), videoChunkPool);
                        test.Execute(KeepProcessedFrames);
                        OnUi(() => Results.Add(test));
                    }
                }
            }
        }
コード例 #2
0
        // Executes when the user navigates to this page.
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            btnSaveRaw.IsEnabled = false;
            btnPlayRaw.IsEnabled = false;

            videoCapture.Height           = VideoConstants.Height;
            videoCapture.Width            = VideoConstants.Width;
            mRawMediaElement.Height       = VideoConstants.Height;
            mRawMediaElement.Width        = VideoConstants.Width;
            mProcessedMediaElement.Height = VideoConstants.Height;
            mProcessedMediaElement.Width  = VideoConstants.Width;

            // Initialize and capture the webcam.
            InitializeCaptureSource();
            CaptureSelectedInputDevices();
            var videoBrush = new VideoBrush();

            videoBrush.SetSource(mCaptureSource);
            videoCapture.Fill = videoBrush;

            // Setup the recorder
            mVideoQualityController = new TestVideoQualityController();
            mRecorder  = new Recorder();
            mVideoSink = new VideoSinkAdapter(mCaptureSource, mRecorder, mVideoQualityController);
            lblFramesRecorded.DataContext = mRecorder;
        }