我有一个C#应用程序,它使用本地库,使用UDP通过Internet将视频发送到其他IP.我对该库没有流量控制.
我的应用程序还调用另一台服务器的Web服务,使用WebRequest我可以控制它们.
问题是:
当我的互联网带宽较低时,视频流会占用我所有的带宽.因此,在此期间我无法获得我的Web服务方法的响应.
有没有办法优先考虑WebRequest或为他们节省一些带宽,以便我可以安全地获得响应?
我使用ffmpeg使用以下代码记录窗口:
ffmpeg.exe
-f dshow
-y
-i video="screen-capture-recorder":audio="virtual-audio-capturer":audio="Microphone (USB Audio Device)"
-framerate 15
-vcodec libx264
-crf 0
-preset ultrafast
-acodec pcm_s16le
-vf crop=Width:Height:Left:Top
output.flv
Run Code Online (Sandbox Code Playgroud)
但问题是我可能会移动窗口,这会导致记录一个没有我想要的窗口的区域.
如何捕获我能够移动它的特定窗口?
编辑:我也习惯gdigrab捕捉我的窗口(Skype例如)而不是dshow:
ffmpeg.exe
-y
-f dshow
-i audio="virtual-audio-capturer":audio="Microphone (USB Audio Device)"
-f gdigrab
-draw_mouse 0
-i title="Skype"
-framerate 30
-vcodec libx264
-crf 0
-preset ultrafast
-acodec pcm_s16le
output.flv
Run Code Online (Sandbox Code Playgroud)
但会议是黑色的......
我67从下面的代码收到错误代码,这意味着ERROR_BAD_NET_NAME.
为什么会这样?我该如何解决?
SOCKADDR address;
strcpy_s(address.sa_data, "8.8.8.8");
address.sa_family = AF_INET;
if (!QOSStartTrackingClient(QoSHandle, &address, 0))
cout << GetLastError();
Run Code Online (Sandbox Code Playgroud) 我有一个连接到多个服务器的C#客户端应用程序.我注意到,当客户端计算机上有如此多的流量时,必须使用NetLimiter激活的规则才能使我的客户端以更高的优先级正确连接.
我没有找到任何关于如何在此应用程序中以编程方式嵌入和制定规则的文档.但是,我在这里读到有人试图使用Netlimiter API但失败了.
我在某处读到我可以编写自己的应用程序,在这里使用Windows的TC API 并标记DSCP以确定优先级.但是在设置C#应用程序的流程选项之前,我已经解决了这个问题.
请指导我这个问题.
我写了一个java应用程序,我在Fedora 24下运行了java进程。然后我检查了jconsole,发现它使用了大约5到10兆字节的内存。垃圾收集的效果在图中也可见。
然后我检查了我的系统监视器,发现相同的进程 ID 有超过 100 兆字节的内存使用量。
这是屏幕截图:
请告诉我为什么进程不释放未使用的内存?
有什么办法可以释放吗?
我想在bash(Windows中的Linux子系统)中运行以下命令:
bash -c "ls"
Run Code Online (Sandbox Code Playgroud)
并在C#中像这样使用它:
ProcessStartInfo info = new ProcessStartInfo("bash", "-c \"ls\"");
Process p = Process.Start(info);
p.WaitForExit();
Run Code Online (Sandbox Code Playgroud)
但这给了我以下例外:
System.ComponentModel.Win32Exception was unhandled
ErrorCode=-2147467259
HResult=-2147467259
Message=The system cannot find the file specified
NativeErrorCode=2
Source=System
StackTrace:
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at ConsoleApplication1.Program.Main(String[] args) in c:\users\matin\documents\visual studio 2015\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs:line 17
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, …Run Code Online (Sandbox Code Playgroud) 我有一个结构:
public class DataItem {
public int wordID, categoryID, documentID, count;
}
Run Code Online (Sandbox Code Playgroud)
我有一个如下所示的列表:
final public ArrayList<DataItem> data = new ArrayList<>();
Run Code Online (Sandbox Code Playgroud)
我写了一个在其中搜索的方法:
public DataItem FindDataItem(final int wordID, final int categoryID, final int documentID)
{
for(DataItem dataItem : data)
if(dataItem.wordID == wordID && dataItem.documentID == documentID && dataItem.categoryID == categoryID)
return dataItem;
return null;
}
Run Code Online (Sandbox Code Playgroud)
但它太慢了。我怎样才能加快速度?
我正在考虑四个HashMap彼此内部,但我想像数据库表一样使用这些数据,因此很难在HashMap中按计数进行分组
我也在考虑ParalellStream,但我不知道如何使用它。看起来很复杂。但仍然是 O(n)。
我也在考虑使用数据库。但我不想有IO。我想把它全部放在内存中。
请引导我完成这个过程。
我用Qt编写了一个简单的信号槽应用程序.我想向另一个用完主线程的线程发送信号.
这是我的代码:
class Thread1 : public QThread
{
Q_OBJECT
void run()
{
exec();
}
public:
Thread1(QObject* parent);
public slots:
void a()
{
qInfo()<<QThread::currentThreadId();
}
};
class Object : public QObject
{
Q_OBJECT
public:
Object(){}
void start()
{
qInfo()<<QThread::currentThreadId();
Thread1* thread = new Thread1(this);
connect(this,SIGNAL(a()),thread,SLOT(a()));
thread->start();
emit a();
}
signals:
void a();
};
Run Code Online (Sandbox Code Playgroud)
但它返回:
0x7f9851c988c0
0x7f9851c988c0
Run Code Online (Sandbox Code Playgroud)
如何调用输出另一个threadID的信号?