Small code cleanup

This commit is contained in:
genteure 2022-06-30 21:37:00 +08:00
parent 9865c841bd
commit 59e43973eb
6 changed files with 9 additions and 15 deletions

View File

@ -226,12 +226,12 @@ namespace BililiveRecorder.Core.Recording
}
const int DefaultQn = 10000;
var selected_qn = DefaultQn;
var codecItem = await this.apiClient.GetCodecItemInStreamUrlAsync(roomid: roomid, qn: DefaultQn).ConfigureAwait(false);
if (codecItem is null)
throw new Exception("no supported stream url, qn: " + DefaultQn);
int selected_qn;
// Select first avaiable qn
foreach (var qn in qns)
{
@ -298,8 +298,6 @@ namespace BililiveRecorder.Core.Recording
{
this.logger.Debug("用户脚本指定了服务器 IP {IP}", scriptIp);
request = new HttpRequestMessage(HttpMethod.Get, fullUrl);
var uri = new Uri(fullUrl);
var builder = new UriBuilder(uri)
{

View File

@ -62,7 +62,7 @@ namespace BililiveRecorder.Core
this.basicDanmakuWriter = basicDanmakuWriter ?? throw new ArgumentNullException(nameof(basicDanmakuWriter));
this.recordTaskFactory = recordTaskFactory ?? throw new ArgumentNullException(nameof(recordTaskFactory));
this.timer = new Timer(this.RoomConfig.TimingCheckInterval * 1000);
this.timer = new Timer(this.RoomConfig.TimingCheckInterval * 1000d);
this.cts = new CancellationTokenSource();
this.ct = this.cts.Token;
@ -555,7 +555,7 @@ namespace BililiveRecorder.Core
this.logger = this.loggerWithoutContext.ForContext(LoggingContext.RoomId, this.RoomConfig.RoomId);
break;
case nameof(this.RoomConfig.TimingCheckInterval):
this.timer.Interval = this.RoomConfig.TimingCheckInterval * 1000;
this.timer.Interval = this.RoomConfig.TimingCheckInterval * 1000d;
break;
case nameof(this.RoomConfig.AutoRecord):
if (this.RoomConfig.AutoRecord)

View File

@ -84,8 +84,6 @@ namespace BililiveRecorder.Flv.Grouping
firstTag
};
firstTag = null;
while (!token.IsCancellationRequested)
{
var tag = await this.TagReader.ReadTagAsync(token).ConfigureAwait(false);

View File

@ -104,11 +104,11 @@ namespace BililiveRecorder.Flv.Parser
if (result.IsCompleted)
{
if (buffer.Length > 0)
{
// The message is incomplete and there's no more data to process.
// throw new FlvException("Incomplete message.");
}
//if (buffer.Length > 0)
//{
//// The message is incomplete and there's no more data to process.
//// throw new FlvException("Incomplete message.");
//}
break;
}

View File

@ -36,8 +36,6 @@ namespace BililiveRecorder.Flv.Pipeline.Rules
var multiple_header_present = false;
// 音频 视频 分别单独处理
var group = header.AllTags.GroupBy(x => x.Type);
var currentVideoHeader = SelectHeader(ref multiple_header_present, header.AllTags.ToStructEnumerable().Where(ref LinqFunctions.TagIsVideo, x => x));
var currentAudioHeader = SelectHeader(ref multiple_header_present, header.AllTags.ToStructEnumerable().Where(ref LinqFunctions.TagIsAudio, x => x));

View File

@ -195,7 +195,7 @@ namespace BililiveRecorder.ToolBox.Tool.DanmakuMerger
if (els.Count == 0)
break;
(var time, var el, var readerIndex) = els[0];
(_, var el, var readerIndex) = els[0];
el.WriteTo(writer);
els.RemoveAt(0);