public Task <Packet> NextPacket(CancellationToken token) { if (!IsInitialized()) { throw new InvalidOperationException(); } return(thread.Factory.StartNew(() => { _operationMonitor.Start(token); var packet = formatContext.NextPacket(audioIdx, videoIdx); _operationMonitor.End(); if (packet == null) { completionSource?.SetResult(true); } return packet; }, token)); }
public Task <Packet> NextPacket() { if (!IsInitialized()) { throw new InvalidOperationException(); } return(thread.Factory.StartNew(() => { var streamIndexes = new[] { audioIdx, videoIdx }; var packet = formatContext.NextPacket(streamIndexes); if (packet == null) { completionSource?.SetResult(true); } return packet; })); }