mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-11-15 19:22:19 +08:00
FLV: Add workaround for streaming data from d1--ov-gotcha07.bilivideo.com
CNAME d1--ov-gotcha07.bilivideo.com.a.bcelive.com CNAME d1--ov-gotcha07.bilivideo.com.zengslb.com Zenlayer Singapore
This commit is contained in:
parent
08b5fb4dc5
commit
55594ab77c
|
@ -13,6 +13,7 @@ namespace BililiveRecorder.Flv.Pipeline.Rules
|
|||
/// </remarks>
|
||||
public class HandleNewScriptRule : ISimpleProcessingRule
|
||||
{
|
||||
private const string onMetaData = "onMetaData";
|
||||
private static readonly ProcessingComment comment_onmetadata = new ProcessingComment(CommentType.Logging, "收到了 onMetaData");
|
||||
|
||||
public void Run(FlvProcessingContext context, Action next)
|
||||
|
@ -23,40 +24,71 @@ namespace BililiveRecorder.Flv.Pipeline.Rules
|
|||
|
||||
private IEnumerable<PipelineAction?> RunPerAction(FlvProcessingContext context, PipelineAction action)
|
||||
{
|
||||
ScriptTagBody? data;
|
||||
if (action is PipelineScriptAction scriptAction)
|
||||
{
|
||||
var data = scriptAction.Tag.ScriptData;
|
||||
if (!(data is null)
|
||||
&& data.Values.Count == 2
|
||||
&& data.Values[0] is ScriptDataString name
|
||||
&& name == "onMetaData")
|
||||
data = scriptAction.Tag.ScriptData;
|
||||
if (data is not null)
|
||||
{
|
||||
ScriptDataEcmaArray value = data.Values[1] switch
|
||||
if (data.Values.Count == 2
|
||||
&& data.Values[0] is ScriptDataString name
|
||||
&& name == onMetaData)
|
||||
{
|
||||
ScriptDataObject obj => obj,
|
||||
ScriptDataEcmaArray arr => arr,
|
||||
_ => new ScriptDataEcmaArray()
|
||||
};
|
||||
|
||||
context.AddComment(comment_onmetadata);
|
||||
yield return PipelineNewFileAction.Instance;
|
||||
yield return (new PipelineScriptAction(new Tag
|
||||
goto IsOnMetaData;
|
||||
}
|
||||
else if (data.Values.Count == 3
|
||||
&& data.Values[2] is ScriptDataNull
|
||||
&& data.Values[0] is ScriptDataString name2
|
||||
&& name2 == onMetaData)
|
||||
{
|
||||
Type = TagType.Script,
|
||||
ScriptData = new ScriptTagBody(new List<IScriptDataValue>
|
||||
{
|
||||
name,
|
||||
value
|
||||
})
|
||||
}));
|
||||
/* d1--ov-gotcha07.bilivideo.com
|
||||
* CNAME d1--ov-gotcha07.bilivideo.com.a.bcelive.com
|
||||
* CNAME d1--ov-gotcha07.bilivideo.com.zengslb.com
|
||||
* Singapore AS21859 Zenlayer Inc
|
||||
*
|
||||
* 给的 script tag 数据里第三个位置多了个 NULL
|
||||
*/
|
||||
goto IsOnMetaData;
|
||||
}
|
||||
else
|
||||
{
|
||||
goto notOnMetaData;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
context.AddComment(new ProcessingComment(CommentType.Logging, "收到了非 onMetaData 的 Script Tag: " + (data?.ToJson() ?? "(null)")));
|
||||
goto notOnMetaData;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
yield return action;
|
||||
yield break;
|
||||
}
|
||||
|
||||
IsOnMetaData:
|
||||
ScriptDataEcmaArray value = data.Values[1] switch
|
||||
{
|
||||
ScriptDataObject obj => obj,
|
||||
ScriptDataEcmaArray arr => arr,
|
||||
_ => new ScriptDataEcmaArray()
|
||||
};
|
||||
context.AddComment(comment_onmetadata);
|
||||
yield return PipelineNewFileAction.Instance;
|
||||
yield return (new PipelineScriptAction(new Tag
|
||||
{
|
||||
Type = TagType.Script,
|
||||
ScriptData = new ScriptTagBody(new List<IScriptDataValue>
|
||||
{
|
||||
(ScriptDataString)onMetaData,
|
||||
value
|
||||
})
|
||||
}));
|
||||
yield break;
|
||||
|
||||
notOnMetaData:
|
||||
context.AddComment(new ProcessingComment(CommentType.Logging, "收到了非 onMetaData 的 Script Tag: " + (data?.ToJson() ?? "(null)")));
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user