-
Notifications
You must be signed in to change notification settings - Fork 1
Remove output stream logic. #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ | |
| public class MagewellMuxer | ||
| { | ||
| private final FFmpegFrameRecorder recorder; | ||
| private boolean closed = false; | ||
|
|
||
| public MagewellMuxer(File videoCaptureFile, int captureWidth, int captureHeight) | ||
| { | ||
|
|
@@ -55,20 +56,17 @@ public void recordFrame(Frame capturedFrame, long videoTimestamp) | |
| // This is where a frame is record, and we then need to store the timestamps, so they are synced | ||
| try | ||
| { | ||
| if (!recorder.isCloseOutputStream()) | ||
| { | ||
| recorder.record(capturedFrame); | ||
| } | ||
| recorder.record(capturedFrame); | ||
| } | ||
| catch (Exception e) | ||
| { | ||
| throw new RuntimeException(e); | ||
| } | ||
| } | ||
|
|
||
| public boolean isCloseOutputStream() | ||
| public boolean isClosed() | ||
| { | ||
| return recorder.isCloseOutputStream(); | ||
| return closed; | ||
| } | ||
|
|
||
| public long getTimeStamp() | ||
|
|
@@ -78,10 +76,9 @@ public long getTimeStamp() | |
|
|
||
| public void close() | ||
| { | ||
| recorder.setCloseOutputStream(true); | ||
| closed = true; | ||
| try | ||
| { | ||
| recorder.flush(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| recorder.stop(); | ||
| } | ||
| catch (Exception e) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -105,7 +105,7 @@ public void startCapture() throws Exception | |
|
|
||
| long startTime = System.currentTimeMillis(); | ||
| Frame capturedFrame; | ||
| while (!magewellMuxer.isCloseOutputStream() && ((capturedFrame = grabber.grabAtFrameRate()) != null)) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wait, so were we actually using the closeOutputStream variable to signal that we wanted to stop the recording?? 😂 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've added back the closed logic, but not using an unrelated internal variable |
||
| while (!magewellMuxer.isClosed() && ((capturedFrame = grabber.grabAtFrameRate()) != null)) | ||
| { | ||
| long videoTimestamp = CaptureTimeTools.timeSinceStartedCaptureInSeconds(System.currentTimeMillis(), startTime); | ||
| magewellMuxer.recordFrame(capturedFrame, videoTimestamp); | ||
|
|
||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
close output stream is only for when you pass one in. we're passing in a file. it's always gonna be false

