Skip to content

Commit

Permalink
Merge branch 'masterQ' into pull_request_Q
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcohn authored Mar 28, 2020
2 parents b5d70e7 + 777c9b4 commit 7e82894
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class FFcommandExecuteAsyncTask extends AsyncTask<Void, String, CommandResult> i
private final long timeout;
private long startTime;
private Process process;
private StringBuilder outputStringBuilder = new StringBuilder();
private String output = "";
private boolean quitPending;

Expand All @@ -39,23 +40,27 @@ protected void onPreExecute() {

@Override
protected CommandResult doInBackground(Void... params) {
CommandResult ret = CommandResult.getDummyFailureResponse();
try {
process = shellCommand.run(cmd, environment);
if (process == null) {
return CommandResult.getDummyFailureResponse();
}
Log.d("Running publishing updates method");
checkAndUpdateProcess();
return CommandResult.getOutputFromProcess(process);
ret = CommandResult.getOutputFromProcess(process);
outputStringBuilder.append(ret.output);
} catch (TimeoutException e) {
Log.e("FFmpeg binary timed out", e);
return new CommandResult(false, e.getMessage());
ret = new CommandResult(false, e.getMessage());
outputStringBuilder.append(ret.output);
} catch (Exception e) {
Log.e("Error running FFmpeg binary", e);
} finally {
Util.destroyProcess(process);
}
return CommandResult.getDummyFailureResponse();
output = outputStringBuilder.toString();
return ret;
}

@Override
Expand All @@ -68,7 +73,6 @@ protected void onProgressUpdate(String... values) {
@Override
protected void onPostExecute(CommandResult commandResult) {
if (ffmpegExecuteResponseHandler != null) {
output += commandResult.output;
if (commandResult.success) {
ffmpegExecuteResponseHandler.onSuccess(output);
} else {
Expand Down Expand Up @@ -107,7 +111,7 @@ private void checkAndUpdateProcess() throws TimeoutException, InterruptedExcepti
return;
}

output += line + "\n";
outputStringBuilder.append(line); outputStringBuilder.append("\n");
publishProgress(line);
}
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import java.io.File;

class FileUtils {
private static final String FFMPEG_FILE_NAME = "ffmpeg";
private static final String FFPROBE_FILE_NAME = "ffprobe";
private static final String FFMPEG_FILE_NAME = "lib..ffmpeg..so";
private static final String FFPROBE_FILE_NAME = "lib..ffprobe.so";

static File getFFmpeg(Context context) {
File folder = new File(context.getApplicationInfo().nativeLibraryDir);
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 7e82894

Please sign in to comment.