improving framedrop code, bugfixes, got rid of tabs in source (I hate tabs), and other things

This commit is contained in:
jim 2012-11-21 11:21:40 -07:00
parent 0b51cf7157
commit 129e068b1d
21 changed files with 1311 additions and 1252 deletions

View File

@ -68,6 +68,7 @@
LinkIncremental="2" LinkIncremental="2"
AdditionalLibraryDirectories="../OBSApi/Debug" AdditionalLibraryDirectories="../OBSApi/Debug"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="..\rundir\$(TargetName).pdb"
SubSystem="2" SubSystem="2"
TargetMachine="1" TargetMachine="1"
/> />
@ -144,6 +145,7 @@
LinkIncremental="2" LinkIncremental="2"
AdditionalLibraryDirectories="../OBSApi/x64/Debug" AdditionalLibraryDirectories="../OBSApi/x64/Debug"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="..\rundir\$(TargetName).pdb"
SubSystem="2" SubSystem="2"
TargetMachine="17" TargetMachine="17"
/> />
@ -220,6 +222,7 @@
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="../OBSApi/Release" AdditionalLibraryDirectories="../OBSApi/Release"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="..\rundir\$(TargetName).pdb"
SubSystem="2" SubSystem="2"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"
@ -299,6 +302,7 @@
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="../OBSApi/x64/Release" AdditionalLibraryDirectories="../OBSApi/x64/Release"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="..\rundir\$(TargetName).pdb"
SubSystem="2" SubSystem="2"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"

View File

@ -68,6 +68,7 @@
AdditionalDependencies="dxguid.lib" AdditionalDependencies="dxguid.lib"
LinkIncremental="2" LinkIncremental="2"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="..\rundir\$(TargetName).pdb"
SubSystem="2" SubSystem="2"
TargetMachine="1" TargetMachine="1"
/> />
@ -145,6 +146,7 @@
OutputFile="$(OutDir)\$(ProjectName).dll" OutputFile="$(OutDir)\$(ProjectName).dll"
LinkIncremental="2" LinkIncremental="2"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="..\rundir\$(TargetName).pdb"
SubSystem="2" SubSystem="2"
TargetMachine="17" TargetMachine="17"
/> />
@ -220,6 +222,7 @@
AdditionalDependencies="dxguid.lib" AdditionalDependencies="dxguid.lib"
LinkIncremental="1" LinkIncremental="1"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="..\rundir\$(TargetName).pdb"
SubSystem="2" SubSystem="2"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"
@ -299,6 +302,7 @@
OutputFile="$(OutDir)\$(ProjectName).dll" OutputFile="$(OutDir)\$(ProjectName).dll"
LinkIncremental="1" LinkIncremental="1"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="..\rundir\$(TargetName).pdb"
SubSystem="2" SubSystem="2"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"

View File

@ -176,9 +176,13 @@ void GraphicsCaptureSource::NewCapture(LPVOID address)
void GraphicsCaptureSource::EndCapture() void GraphicsCaptureSource::EndCapture()
{ {
if(capture)
{
capture->Destroy(); capture->Destroy();
delete capture; delete capture;
capture = NULL; capture = NULL;
}
bErrorAcquiring = false; bErrorAcquiring = false;
bCapturing = false; bCapturing = false;
captureCheckInterval = -1.0f; captureCheckInterval = -1.0f;

6
OBS.rc
View File

@ -402,13 +402,13 @@ BEGIN
PUSHBUTTON "Cancel",IDCANCEL,310,286,50,14 PUSHBUTTON "Cancel",IDCANCEL,310,286,50,14
END END
IDD_ENDINGDELAY DIALOGEX 0, 0, 258, 48 IDD_ENDINGDELAY DIALOGEX 0, 0, 258, 50
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "EndingDelay" CAPTION "EndingDelay"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
PUSHBUTTON "MainWindow.StopStream",IDCANCEL,86,26,85,14
CTEXT "",IDC_TIMELEFT,7,8,244,8 CTEXT "",IDC_TIMELEFT,7,8,244,8
PUSHBUTTON "Cancel",IDCANCEL,90,29,77,14
END END
@ -561,7 +561,7 @@ BEGIN
LEFTMARGIN, 7 LEFTMARGIN, 7
RIGHTMARGIN, 251 RIGHTMARGIN, 251
TOPMARGIN, 7 TOPMARGIN, 7
BOTTOMMARGIN, 41 BOTTOMMARGIN, 43
END END
END END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED

View File

@ -71,7 +71,7 @@
AdditionalLibraryDirectories="OBSApi/Debug;x264/libs/32bit;librtmp/debug;lame/output/32bit;libfaac/debug;libsamplerate/debug" AdditionalLibraryDirectories="OBSApi/Debug;x264/libs/32bit;librtmp/debug;lame/output/32bit;libfaac/debug;libsamplerate/debug"
AdditionalManifestDependencies="type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='X86' publicKeyToken='6595b64144ccf1df' language='*'" AdditionalManifestDependencies="type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='X86' publicKeyToken='6595b64144ccf1df' language='*'"
GenerateDebugInformation="true" GenerateDebugInformation="true"
StripPrivateSymbols="rundir\$(TargetName).pdb" ProgramDatabaseFile="rundir\$(TargetName).pdb"
SubSystem="2" SubSystem="2"
TargetMachine="1" TargetMachine="1"
/> />
@ -150,7 +150,7 @@
AdditionalLibraryDirectories="OBSApi/x64/Debug;x264/libs/64bit;librtmp/x64/debug;lame/output/64bit;libfaac/x64/debug;libsamplerate/x64/debug" AdditionalLibraryDirectories="OBSApi/x64/Debug;x264/libs/64bit;librtmp/x64/debug;lame/output/64bit;libfaac/x64/debug;libsamplerate/x64/debug"
AdditionalManifestDependencies="type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'" AdditionalManifestDependencies="type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'"
GenerateDebugInformation="true" GenerateDebugInformation="true"
StripPrivateSymbols="rundir\$(TargetName).pdb" ProgramDatabaseFile="rundir\$(TargetName).pdb"
SubSystem="2" SubSystem="2"
TargetMachine="17" TargetMachine="17"
/> />
@ -232,7 +232,7 @@
AdditionalLibraryDirectories="OBSApi/Release;x264/libs/32bit;librtmp/release;lame/output/32bit;libfaac/release;libsamplerate/release" AdditionalLibraryDirectories="OBSApi/Release;x264/libs/32bit;librtmp/release;lame/output/32bit;libfaac/release;libsamplerate/release"
AdditionalManifestDependencies="type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='X86' publicKeyToken='6595b64144ccf1df' language='*'" AdditionalManifestDependencies="type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='X86' publicKeyToken='6595b64144ccf1df' language='*'"
GenerateDebugInformation="true" GenerateDebugInformation="true"
StripPrivateSymbols="rundir\$(TargetName).pdb" ProgramDatabaseFile="rundir\$(TargetName).pdb"
SubSystem="2" SubSystem="2"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"
@ -316,7 +316,7 @@
AdditionalLibraryDirectories="OBSApi/x64/Release;x264/libs/64bit;librtmp/x64/release;lame/output/64bit;libfaac/x64/release;libsamplerate/x64/release" AdditionalLibraryDirectories="OBSApi/x64/Release;x264/libs/64bit;librtmp/x64/release;lame/output/64bit;libfaac/x64/release;libsamplerate/x64/release"
AdditionalManifestDependencies="type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'" AdditionalManifestDependencies="type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'"
GenerateDebugInformation="true" GenerateDebugInformation="true"
StripPrivateSymbols="rundir\$(TargetName).pdb" ProgramDatabaseFile="rundir\$(TargetName).pdb"
SubSystem="2" SubSystem="2"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"

View File

@ -67,7 +67,7 @@
AdditionalDependencies="winmm.lib psapi.lib" AdditionalDependencies="winmm.lib psapi.lib"
LinkIncremental="2" LinkIncremental="2"
GenerateDebugInformation="true" GenerateDebugInformation="true"
StripPrivateSymbols="..\rundir\$(TargetName).pdb" ProgramDatabaseFile="..\rundir\$(TargetName).pdb"
SubSystem="2" SubSystem="2"
TargetMachine="1" TargetMachine="1"
/> />
@ -142,7 +142,7 @@
AdditionalDependencies="winmm.lib psapi.lib" AdditionalDependencies="winmm.lib psapi.lib"
LinkIncremental="2" LinkIncremental="2"
GenerateDebugInformation="true" GenerateDebugInformation="true"
StripPrivateSymbols="..\rundir\$(TargetName).pdb" ProgramDatabaseFile="..\rundir\$(TargetName).pdb"
SubSystem="2" SubSystem="2"
TargetMachine="17" TargetMachine="17"
/> />
@ -218,7 +218,7 @@
AdditionalDependencies="winmm.lib psapi.lib" AdditionalDependencies="winmm.lib psapi.lib"
LinkIncremental="1" LinkIncremental="1"
GenerateDebugInformation="true" GenerateDebugInformation="true"
StripPrivateSymbols="..\rundir\$(TargetName).pdb" ProgramDatabaseFile="..\rundir\$(TargetName).pdb"
SubSystem="2" SubSystem="2"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"
@ -298,7 +298,7 @@
AdditionalDependencies="winmm.lib psapi.lib" AdditionalDependencies="winmm.lib psapi.lib"
LinkIncremental="1" LinkIncremental="1"
GenerateDebugInformation="true" GenerateDebugInformation="true"
StripPrivateSymbols="..\rundir\$(TargetName).pdb" ProgramDatabaseFile="..\rundir\$(TargetName).pdb"
SubSystem="2" SubSystem="2"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"

View File

@ -62,15 +62,26 @@ class DelayedPublisher : public NetworkStream
static INT_PTR CALLBACK EndDelayProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) static INT_PTR CALLBACK EndDelayProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
if(message == WM_INITDIALOG) switch(message)
{ {
case WM_INITDIALOG:
LocalizeWindow(hwnd); LocalizeWindow(hwnd);
SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR)lParam); SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR)lParam);
return TRUE; return TRUE;
}
else if(message == WM_COMMAND && LOWORD(wParam) == IDCANCEL) case WM_COMMAND:
if(LOWORD(wParam) == IDCANCEL)
{ {
DelayedPublisher *publisher = (DelayedPublisher*)GetWindowLongPtr(hwnd, DWLP_USER); DelayedPublisher *publisher = (DelayedPublisher*)GetWindowLongPtr(hwnd, DWLP_USER);
publisher->bCancelEnd = true;
}
break;
case WM_CLOSE:
{
DelayedPublisher *publisher = (DelayedPublisher*)GetWindowLongPtr(hwnd, DWLP_USER);
publisher->bCancelEnd = true;
}
} }
return 0; return 0;
} }
@ -127,24 +138,34 @@ public:
{ {
bStreamEnding = true; bStreamEnding = true;
HWND hwndProgressDialog = CreateDialogParam(hinstMain, MAKEINTRESOURCE(IDD_ENDINGDELAY), hwndMain, (DLGPROC)EndDelayProc, (LPARAM)this); HWND hwndProgressDialog = CreateDialogParam(hinstMain, MAKEINTRESOURCE(IDD_ENDINGDELAY), hwndMain, (DLGPROC)EndDelayProc, (LPARAM)this);
ProcessEvents();
ShowWindow(hwndProgressDialog, TRUE); ShowWindow(hwndProgressDialog, TRUE);
DWORD totalTimeLeft = delayTime; DWORD totalTimeLeft = delayTime;
String strTimeLeftVal = Str("EndingDelay.TimeLeft"); String strTimeLeftVal = Str("EndingDelay.TimeLeft");
DWORD lastTimeLeft = -1;
DWORD firstTime = OSGetTime(); DWORD firstTime = OSGetTime();
while(queuedPackets.Num() && !bCancelEnd) while(queuedPackets.Num() && !bCancelEnd)
{ {
ProcessEvents();
DWORD timeElapsed = (OSGetTime()-firstTime); DWORD timeElapsed = (OSGetTime()-firstTime);
DWORD timeLeft = (totalTimeLeft-timeElapsed)/1000; DWORD timeLeft = (totalTimeLeft-timeElapsed)/1000;
DWORD timeLeftMinutes = timeLeft/60; DWORD timeLeftMinutes = timeLeft/60;
DWORD timeLeftSeconds = timeLeft%60; DWORD timeLeftSeconds = timeLeft%60;
if(timeLeft != lastTimeLeft)
{
String strTimeLeft = strTimeLeftVal; String strTimeLeft = strTimeLeftVal;
strTimeLeft.FindReplace(TEXT("$1"), FormattedString(TEXT("%u:%02u"), timeLeftMinutes, timeLeftSeconds)); strTimeLeft.FindReplace(TEXT("$1"), FormattedString(TEXT("%u:%02u"), timeLeftMinutes, timeLeftSeconds));
SetWindowText(GetDlgItem(hwndProgressDialog, IDC_TIMELEFT), strTimeLeft); SetWindowText(GetDlgItem(hwndProgressDialog, IDC_TIMELEFT), strTimeLeft);
lastTimeLeft = timeLeft;
}
ProcessPackets(lastTimestamp+timeElapsed); ProcessPackets(lastTimestamp+timeElapsed);
if(outputStream && outputStream->bStopping) if(outputStream && outputStream->bStopping)

View File

@ -56,17 +56,6 @@ struct MP4AudioFrameInfo
#define USE_64BIT_MP4 1 #define USE_64BIT_MP4 1
void WINAPI ProcessEvents()
{
MSG msg;
while(PeekMessage(&msg, NULL, 0, 0, 1))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
//code annoyance rating: fairly nightmarish //code annoyance rating: fairly nightmarish
class MP4FileStream : public VideoFileStream class MP4FileStream : public VideoFileStream

View File

@ -276,6 +276,15 @@ void LoadGlobalIni()
} }
} }
void WINAPI ProcessEvents()
{
MSG msg;
while(PeekMessage(&msg, NULL, 0, 0, 1))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{ {

View File

@ -62,7 +62,7 @@ extern OBS *App;
extern TCHAR lpAppDataPath[MAX_PATH]; extern TCHAR lpAppDataPath[MAX_PATH];
#define OBS_VERSION 0x000445 #define OBS_VERSION 0x000445
#define OBS_VERSION_STRING_ANSI "Open Broadcaster Software v0.445a [pre-release 2]" #define OBS_VERSION_STRING_ANSI "Open Broadcaster Software v0.445a [pre-release 3]"
#define OBS_VERSION_STRING TEXT(OBS_VERSION_STRING_ANSI) #define OBS_VERSION_STRING TEXT(OBS_VERSION_STRING_ANSI)
#define OBS_WINDOW_CLASS TEXT("OBSWindowClass") #define OBS_WINDOW_CLASS TEXT("OBSWindowClass")
@ -73,6 +73,8 @@ inline UINT ConvertMSTo100NanoSec(UINT ms)
return ms*1000*10; //1000 microseconds, then 10 "100nanosecond" segments return ms*1000*10; //1000 microseconds, then 10 "100nanosecond" segments
} }
void WINAPI ProcessEvents();
//------------------------------------------- //-------------------------------------------
// application headers // application headers

View File

@ -158,7 +158,10 @@ void RTMPPublisher::SendPacket(BYTE *data, UINT size, DWORD timestamp, PacketTyp
// debug stuff // if (bPacketDumpMode) // debug stuff // if (bPacketDumpMode)
// Log(TEXT("BitsIn: %u, BitsOut: %u"), BitsPerTime(&bitsIn, t), BitsPerTime(&bitsOut, t)); // Log(TEXT("BitsIn: %u, BitsOut: %u"), BitsPerTime(&bitsIn, t), BitsPerTime(&bitsOut, t));
if(bPacketDumpMode && (bitsInPerTime <= bitsOutPerTime)) if(bPacketDumpMode && (bitsInPerTime <= bitsOutPerTime))
{
bPacketDumpMode = false; bPacketDumpMode = false;
bDroppingPFrames = false;
}
bool bAddPacket = false; bool bAddPacket = false;
if(type >= packetWaitType) if(type >= packetWaitType)
@ -170,7 +173,6 @@ void RTMPPublisher::SendPacket(BYTE *data, UINT size, DWORD timestamp, PacketTyp
if(type <= PacketType_VideoHigh) if(type <= PacketType_VideoHigh)
{ {
AddBits(&bitsIn, size*8, OSGetTime()); AddBits(&bitsIn, size*8, OSGetTime());
bitsQueued += size*8;
numVideoPackets++; numVideoPackets++;
} }
} }
@ -185,10 +187,15 @@ void RTMPPublisher::SendPacket(BYTE *data, UINT size, DWORD timestamp, PacketTyp
netPacket.timestamp = timestamp; netPacket.timestamp = timestamp;
netPacket.data.TransferFrom(paddedData); netPacket.data.TransferFrom(paddedData);
bitsQueued += netPacket.data.Num()*8;
Log(TEXT("bitsQueued: %u"), bitsQueued);
UINT maxVidyaPackets = App->GetFPS()/10;
//begin dumping b frames if there's signs of lag //begin dumping b frames if there's signs of lag
if (bitsQueued > sendBuffer.Num()*8 && if (bitsQueued > sendBuffer.Num()*8 &&
//bitsQueued > maxBitRate*125 && bitsQueued > bitsInPerTime) bitsQueued > bitsInPerTime &&
bitsQueued > bitsInPerTime) numVideoPackets > maxVidyaPackets)
{ {
if(bitsInPerTime > bitsOutPerTime) if(bitsInPerTime > bitsOutPerTime)
{ {
@ -199,13 +206,16 @@ void RTMPPublisher::SendPacket(BYTE *data, UINT size, DWORD timestamp, PacketTyp
packetWaitType = PacketType_VideoLow; packetWaitType = PacketType_VideoLow;
} }
DumpBFrame(); DumpBFrame();
if(packetWaitType >= PacketType_VideoHigh)
bDroppingPFrames = true;
} }
//begin dumping p frames if b frames aren't enough //begin dumping p frames if b frames aren't enough
if (bitsQueued > sendBuffer.Num()*8 && if (bitsInPerTime > bitsOutPerTime*13/10 && numVideoPacketsBuffered) // TODO: Tweak this
bitsInPerTime > bitsOutPerTime*2 && numVideoPacketsBuffered) // TODO: Tweak this
{ {
DoIFrameDelay(); DoIFrameDelay();
bDroppingPFrames = true;
} }
} }
@ -216,7 +226,7 @@ void RTMPPublisher::SendPacket(BYTE *data, UINT size, DWORD timestamp, PacketTyp
else else
{ {
AddBits(&bitsOut, size*8, OSGetTime()); AddBits(&bitsOut, size*8, OSGetTime());
bitsQueued -= size*8; //bitsQueued -= size*8;
numBFramesDumped++; numBFramesDumped++;
} }
@ -322,12 +332,12 @@ void RTMPPublisher::BeginPublishing()
double RTMPPublisher::GetPacketStrain() const double RTMPPublisher::GetPacketStrain() const
{ {
double dBitsIn = double(bitsInPerTime); if(bDroppingPFrames)
double dBitsOut = double(bitsOutPerTime); return 100.0f;
double val = (dBitsIn-dBitsOut)/dBitsOut*100.0; else if(bPacketDumpMode)
if(val < 0.0) val = 0.0; return 50.f;
else if(val > 1.0) val = 1.0;
return val*val; return 0.0f;
} }
QWORD RTMPPublisher::GetCurrentSentBytes() QWORD RTMPPublisher::GetCurrentSentBytes()
@ -389,9 +399,10 @@ void RTMPPublisher::SendLoop()
if(type <= PacketType_VideoHigh) if(type <= PacketType_VideoHigh)
{ {
AddBits(&bitsOut, packetData.Num()*8, OSGetTime()); AddBits(&bitsOut, packetData.Num()*8, OSGetTime());
bitsQueued -= packetData.Num()*8;
numVideoPackets--; numVideoPackets--;
} }
bitsQueued -= packetData.Num()*8;
Log(TEXT("bitsQueued: %u"), bitsQueued);
OSLeaveMutex(hDataMutex); OSLeaveMutex(hDataMutex);
//-------------------------------------------- //--------------------------------------------
@ -490,9 +501,14 @@ void RTMPPublisher::DoIFrameDelay()
AddBits(&bitsOut, bestPacket.data.Num()*8, OSGetTime()); AddBits(&bitsOut, bestPacket.data.Num()*8, OSGetTime());
bitsQueued -= bestPacket.data.Num()*8; bitsQueued -= bestPacket.data.Num()*8;
Log(TEXT("bitsQueued: %u"), bitsQueued);
bestPacket.data.Clear(); bestPacket.data.Clear();
Packets.Remove(bestItem); Packets.Remove(bestItem);
numVideoPackets--; numVideoPackets--;
if(bestPacket.type >= PacketType_VideoHigh)
numPFramesDumped++;
else
numBFramesDumped++;
//disposing P-frames will corrupt the rest of the frame group, so you have to wait until another I-frame //disposing P-frames will corrupt the rest of the frame group, so you have to wait until another I-frame
if(!bFoundIFrame || !bFoundFrameBeforeIFrame) if(!bFoundIFrame || !bFoundFrameBeforeIFrame)
@ -524,20 +540,28 @@ void RTMPPublisher::DoIFrameDelay()
{ {
AddBits(&bitsOut, packet.data.Num()*8, OSGetTime()); AddBits(&bitsOut, packet.data.Num()*8, OSGetTime());
bitsQueued -= packet.data.Num()*8; bitsQueued -= packet.data.Num()*8;
Log(TEXT("bitsQueued: %u"), bitsQueued);
packet.data.Clear(); packet.data.Clear();
Packets.Remove(i--); Packets.Remove(i--);
numVideoPackets--; numVideoPackets--;
if(packet.type >= PacketType_VideoHigh)
numPFramesDumped++; numPFramesDumped++;
else
numBFramesDumped++;
} }
} }
else if(packet.type == packetWaitType) else if(packet.type == packetWaitType)
{ {
AddBits(&bitsOut, packet.data.Num()*8, OSGetTime()); AddBits(&bitsOut, packet.data.Num()*8, OSGetTime());
bitsQueued -= packet.data.Num()*8; bitsQueued -= packet.data.Num()*8;
Log(TEXT("bitsQueued: %u"), bitsQueued);
packet.data.Clear(); packet.data.Clear();
Packets.Remove(i--); Packets.Remove(i--);
numVideoPackets--; numVideoPackets--;
if(packet.type >= PacketType_VideoHigh)
numPFramesDumped++; numPFramesDumped++;
else
numBFramesDumped++;
bRemovedPacket = true; bRemovedPacket = true;
} }
@ -576,6 +600,7 @@ void RTMPPublisher::DumpBFrame()
{ {
AddBits(&bitsOut, packet.data.Num()*8, OSGetTime()); AddBits(&bitsOut, packet.data.Num()*8, OSGetTime());
bitsQueued -= packet.data.Num()*8; bitsQueued -= packet.data.Num()*8;
Log(TEXT("bitsQueued: %u"), bitsQueued);
packet.data.Clear(); packet.data.Clear();
Packets.Remove(i--); Packets.Remove(i--);
numBFramesDumped++; numBFramesDumped++;
@ -586,6 +611,7 @@ void RTMPPublisher::DumpBFrame()
{ {
AddBits(&bitsOut, packet.data.Num()*8, OSGetTime()); AddBits(&bitsOut, packet.data.Num()*8, OSGetTime());
bitsQueued -= packet.data.Num()*8; bitsQueued -= packet.data.Num()*8;
Log(TEXT("bitsQueued: %u"), bitsQueued);
packet.data.Clear(); packet.data.Clear();
Packets.Remove(i--); Packets.Remove(i--);
numBFramesDumped++; numBFramesDumped++;

View File

@ -62,7 +62,7 @@ protected:
UINT numVideoPacketsBuffered; UINT numVideoPacketsBuffered;
DWORD firstBufferedVideoFrameTimestamp; DWORD firstBufferedVideoFrameTimestamp;
bool bPacketDumpMode; bool bPacketDumpMode, bDroppingPFrames;
BOOL bUseSendBuffer; BOOL bUseSendBuffer;

View File

@ -45,9 +45,9 @@ float ToggleVolumeControlMute(HWND hwnd)
if(!control) if(!control)
CrashError(TEXT("ToggleVolumeControlMute called on a control that's not a volume control")); CrashError(TEXT("ToggleVolumeControlMute called on a control that's not a volume control"));
if(control->curVolume < EPSILON) if(control->curVolume < 0.05f)
{ {
if(control->lastUnmutedVol < EPSILON) if(control->lastUnmutedVol < 0.05f)
control->lastUnmutedVol = 1.0f; control->lastUnmutedVol = 1.0f;
control->curVolume = control->lastUnmutedVol; control->curVolume = control->lastUnmutedVol;
} }
@ -165,9 +165,9 @@ LRESULT CALLBACK VolumeControlProc(HWND hwnd, UINT message, WPARAM wParam, LPARA
{ {
if(control->cy == 32 && x >= (control->cx-32)) if(control->cy == 32 && x >= (control->cx-32))
{ {
if(control->curVolume < EPSILON) if(control->curVolume < 0.05f)
{ {
if(control->lastUnmutedVol < EPSILON) if(control->lastUnmutedVol < 0.05f)
control->lastUnmutedVol = 1.0f; control->lastUnmutedVol = 1.0f;
control->curVolume = control->lastUnmutedVol; control->curVolume = control->lastUnmutedVol;
} }
@ -184,7 +184,7 @@ LRESULT CALLBACK VolumeControlProc(HWND hwnd, UINT message, WPARAM wParam, LPARA
SetCapture(hwnd); SetCapture(hwnd);
control->bHasCapture = true; control->bHasCapture = true;
if(control->curVolume > EPSILON) if(control->curVolume > 0.05f)
control->lastUnmutedVol = control->curVolume; control->lastUnmutedVol = control->curVolume;
int cxAdjust = control->cx; int cxAdjust = control->cx;
@ -246,7 +246,7 @@ LRESULT CALLBACK VolumeControlProc(HWND hwnd, UINT message, WPARAM wParam, LPARA
if(control->bDisabled) if(control->bDisabled)
{ {
if(control->curVolume > EPSILON) if(control->curVolume > 0.05f)
{ {
control->lastUnmutedVol = control->curVolume; control->lastUnmutedVol = control->curVolume;
control->curVolume = 0.0f; control->curVolume = 0.0f;
@ -255,7 +255,7 @@ LRESULT CALLBACK VolumeControlProc(HWND hwnd, UINT message, WPARAM wParam, LPARA
} }
else else
{ {
if(control->curVolume < EPSILON) if(control->curVolume < 0.05f)
{ {
control->curVolume = control->lastUnmutedVol; control->curVolume = control->lastUnmutedVol;
SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(id, VOLN_ADJUSTING), (LPARAM)hwnd); SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(id, VOLN_ADJUSTING), (LPARAM)hwnd);
@ -348,7 +348,7 @@ void VolumeControlData::DrawVolumeControl(HDC hDC)
} }
if(bDrawIcon) if(bDrawIcon)
DrawIcon(hdcTemp, cx-32, 0, (visualVolume > EPSILON) ? hiconPlay : hiconMute); DrawIcon(hdcTemp, cx-32, 0, (visualVolume > 0.05f) ? hiconPlay : hiconMute);
} }
BitBlt(hDC, 0, 0, cx, cy, hdcTemp, 0, 0, SRCCOPY); BitBlt(hDC, 0, 0, cx, cy, hdcTemp, 0, 0, SRCCOPY);

View File

@ -192,8 +192,8 @@
#define IDC_DELAY_STATIC 1126 #define IDC_DELAY_STATIC 1126
#define IDC_ITALIC 1127 #define IDC_ITALIC 1127
#define IDC_TIMELEFT 1127 #define IDC_TIMELEFT 1127
#define IDC_CHECK3 1128
#define IDC_UNLOCKHIGHFPS 1128 #define IDC_UNLOCKHIGHFPS 1128
#define IDC_CANCEL 1130
#define IDA_SOURCE_MOVEUP 40018 #define IDA_SOURCE_MOVEUP 40018
#define IDA_SOURCE_MOVEDOWN 40019 #define IDA_SOURCE_MOVEDOWN 40019
#define IDA_SOURCE_MOVETOTOP 40020 #define IDA_SOURCE_MOVETOTOP 40020
@ -224,7 +224,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 141 #define _APS_NEXT_RESOURCE_VALUE 141
#define _APS_NEXT_COMMAND_VALUE 40044 #define _APS_NEXT_COMMAND_VALUE 40044
#define _APS_NEXT_CONTROL_VALUE 1129 #define _APS_NEXT_CONTROL_VALUE 1132
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif
#endif #endif

View File

@ -144,7 +144,7 @@ Settings.Publish.AutoReconnect "Auto-Reconnect:"
Settings.Publish.AutoReconnectTimeout "Auto-Reconnect Timeout:" Settings.Publish.AutoReconnectTimeout "Auto-Reconnect Timeout:"
Settings.Publish.ChannelName "Channel Name:" Settings.Publish.ChannelName "Channel Name:"
Settings.Publish.DashboardLink "Dashboard Link (if any):" Settings.Publish.DashboardLink "Dashboard Link (if any):"
Settings.Publish.Delay "Delay:" Settings.Publish.Delay "Delay (seconds):"
Settings.Publish.Mode "Mode:" Settings.Publish.Mode "Mode:"
Settings.Publish.Password "Password (if any):" Settings.Publish.Password "Password (if any):"
Settings.Publish.Playpath "Play Path/Stream Key (if any):" Settings.Publish.Playpath "Play Path/Stream Key (if any):"
@ -168,18 +168,18 @@ Settings.Video.FPS "FPS:"
Settings.Video.Monitor "Monitor:" Settings.Video.Monitor "Monitor:"
Settings.Video.Resolution "Base Resolution:" Settings.Video.Resolution "Base Resolution:"
Sources.BitmapSource "Bitmap" Sources.BitmapSource "Image"
Sources.GameCaptureSource "Game Capture Source [experimental]" Sources.GameCaptureSource "Game Capture [experimental]"
Sources.GlobalSource "Global Source" Sources.GlobalSource "Global Source"
Sources.SoftwareCaptureSource "Software Capture Source" Sources.SoftwareCaptureSource "Software Capture"
Sources.TextSource "Text Source" Sources.TextSource "Text"
Sources.TransitionSource "Image Slide Show" Sources.TransitionSource "Image Slide Show"
Sources.BitmapSource.Color "Color:" Sources.BitmapSource.Color "Color:"
Sources.BitmapSource.Empty "No bitmap entered. Please browse and select a bitmap" Sources.BitmapSource.Empty "No bitmap entered. Please browse and select a bitmap"
Sources.BitmapSource.Opacity "Opacity:" Sources.BitmapSource.Opacity "Opacity:"
Sources.GameCaptureSource.Application "Applcation:" Sources.GameCaptureSource.Application "Application:"
Sources.GameCaptureSource.PluginDescription "Captures frames directly from games and graphics applications by hooking into the application and reading the frames as they come in." Sources.GameCaptureSource.PluginDescription "Captures frames directly from games and graphics applications by hooking into the application and reading the frames as they come in."
Sources.GameCaptureSource.PluginName "Game Capture Plugin" Sources.GameCaptureSource.PluginName "Game Capture Plugin"
Sources.GameCaptureSource.StretchToScreen "Stretch image to screen" Sources.GameCaptureSource.StretchToScreen "Stretch image to screen"