Commit 426b31ae authored by Flemming Staebler's avatar Flemming Staebler
Browse files

redid yesterday's work because i forgot to push

parent 67ccdc19
......@@ -194,7 +194,6 @@ export class RecordingService extends EventTarget{
let encode_string = new TextEncoder().encode("ffmpeg -i %05d.png -r 30 -c:v libx264 -crf 18 -pix_fmt yuv420p video.mp4");
this.frameArray.push(TarBall.gen_header("create_mp4_video.sh", encode_string.length));
this.frameArray.push(encode_string);
this.frameArray.push(new ArrayBuffer(512 - (encode_string.length % 512)));
//Save blob
let b = new Blob(this.frameArray);
let a_elem = document.getElementById('downloadlink') as HTMLAnchorElement;
......@@ -263,7 +262,9 @@ export class RecordingService extends EventTarget{
if(!this.frameArray)return;
this.frameArray.push(TarBall.gen_header(FormattingService.leftpad("" + this.render_frame_number , "0", 5) + ".png", b.size));
this.frameArray.push(b);
this.frameArray.push(new ArrayBuffer(512 - (b.size % 512)));
if(b.size % 512){
this.frameArray.push(new ArrayBuffer(512 - (b.size % 512)));
}
console.log(this.frameArray);
this.render_frame_number += 1;
}
......
......@@ -20,6 +20,7 @@ class DisplaySection {
}
export class RenderService{
ready_to_submit_blob: boolean = true;
context: glenv;
layerPipeline: LayerPipelineFramebuffer;
......@@ -292,11 +293,13 @@ export class RenderService{
if(this.is_complete_frame || !Services.RecordingService.acceptsFrames())
Services.ParticlesService.prepareParticles();
this.renderPipeline();
this.is_complete_frame = Services.TileCacheService.is_complete();
this.is_complete_frame = Services.TileCacheService.is_complete() && this.ready_to_submit_blob;
if(this.is_complete_frame && Services.RecordingService.acceptsFrames()){
console.log("Complete frame.", Services.FlexibleTimeBaseService.now());
this.ready_to_submit_blob = false;
this.context.gl.canvas.toBlob((blob) => {
Services.RecordingService.submitFrameBlob(blob);
this.ready_to_submit_blob = true;
});
}
Services.GLService.raiseFrameDoneEvent();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment