protected override void Loop(CancellationToken token)
 {
   // flush packet queue
   _packetQueue.Flush();
   using (var videoDecoder = new VideoPacketDecoder(_pixelFormat))
     while (token.IsCancellationRequested == false)
     {
       VideoPacket packet;
       if (_packetQueue.TryDequeue(out packet))
       {
         VideoFrame frame;
         if (videoDecoder.TryDecode(ref packet, out frame))
         {
           _onFrameDecoded(frame);
         }
       }
       else
       {
         Thread.Sleep(1);
       }
     }
 }
示例#2
0
 protected override void Loop(CancellationToken token)
 {
     // flush packet queue
     _packetQueue.Flush();
     using (var videoDecoder = new VideoPacketDecoder(_pixelFormat))
         while (token.IsCancellationRequested == false)
         {
             VideoPacket packet;
             if (_packetQueue.TryDequeue(out packet))
             {
                 VideoFrame frame;
                 if (videoDecoder.TryDecode(ref packet, out frame))
                 {
                     _onFrameDecoded(frame);
                 }
             }
             else
             {
                 Thread.Sleep(1);
             }
         }
 }