Skip to content

Commit

Permalink
Refactor to call getSize() only once
Browse files Browse the repository at this point in the history
Avoid to call capture.getSize() (provided by the SurfaceCapture
implementation) twice.

PR #5370 <#5370>
  • Loading branch information
rom1v committed Oct 28, 2024
1 parent 5f0480c commit 68e54d9
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,16 @@ private void streamCapture() throws IOException, ConfigurationException {
capture.init();

try {
streamer.writeVideoHeader(capture.getSize());

boolean alive;
boolean headerWritten = false;

do {
Size size = capture.getSize();
if (!headerWritten) {
streamer.writeVideoHeader(size);
headerWritten = true;
}

format.setInteger(MediaFormat.KEY_WIDTH, size.getWidth());
format.setInteger(MediaFormat.KEY_HEIGHT, size.getHeight());

Expand Down

0 comments on commit 68e54d9

Please sign in to comment.