Only show the NaCl plugin when a frame has been rendered

This commit is contained in:
Cameron Gutman 2016-06-09 13:22:27 -05:00
parent 1f3f4bd0aa
commit 6c13c9b67d
3 changed files with 11 additions and 1 deletions

View File

@ -340,7 +340,6 @@ function playGameMode() {
$(".mdl-layout__header").hide();
$("#main-content").children().not("#listener, #loadingSpinner").hide();
$("#main-content").addClass("fullscreen");
$("#listener").addClass("fullscreen");
fullscreenNaclModule();
$("body").css('backgroundColor', 'black');

View File

@ -32,6 +32,8 @@ function handleMessage(msg) {
$('#loadingMessage').text(msg.data.replace('ProgressMsg: ', ''));
} else if(msg.data.indexOf('TransientMsg: ') === 0) {
snackbarLog(msg.data.replace('TransientMsg: ', ''));
} else if(msg.data === 'displayVideo') {
$("#listener").addClass("fullscreen");
}
}
}

View File

@ -17,6 +17,7 @@ static unsigned char s_LastSps[256];
static unsigned char s_LastPps[256];
static unsigned int s_LastSpsLength;
static unsigned int s_LastPpsLength;
static bool s_FirstFrameDisplayed;
static uint64_t s_LastPaintFinishedTime;
#define assertNoGLError() assert(!glGetError())
@ -132,6 +133,7 @@ void MoonlightInstance::VidDecSetup(int videoFormat, int width, int height, int
s_LastTextureId = 0;
s_LastSpsLength = 0;
s_LastPpsLength = 0;
s_FirstFrameDisplayed = false;
int32_t err;
@ -407,6 +409,13 @@ void MoonlightInstance::PaintPicture(void) {
void MoonlightInstance::PaintFinished(int32_t result) {
m_IsPainting = false;
if (!s_FirstFrameDisplayed) {
// Tell the JS code to display the video stream now
pp::Var response("displayVideo");
g_Instance->PostMessage(response);
s_FirstFrameDisplayed = true;
}
ProfilerPrintDeltaFromNow("Paint -> Paint", s_LastPaintFinishedTime);
s_LastPaintFinishedTime = ProfilerGetMillis();