@@ -18,6 +18,7 @@ class FFcommandExecuteAsyncTask extends AsyncTask<Void, String, CommandResult> i
1818 private final long timeout ;
1919 private long startTime ;
2020 private Process process ;
21+ private StringBuilder outputStringBuilder = new StringBuilder ();
2122 private String output = "" ;
2223 private boolean quitPending ;
2324
@@ -39,23 +40,27 @@ protected void onPreExecute() {
3940
4041 @ Override
4142 protected CommandResult doInBackground (Void ... params ) {
43+ CommandResult ret = CommandResult .getDummyFailureResponse ();
4244 try {
4345 process = shellCommand .run (cmd , environment );
4446 if (process == null ) {
4547 return CommandResult .getDummyFailureResponse ();
4648 }
4749 Log .d ("Running publishing updates method" );
4850 checkAndUpdateProcess ();
49- return CommandResult .getOutputFromProcess (process );
51+ ret = CommandResult .getOutputFromProcess (process );
52+ outputStringBuilder .append (ret .output );
5053 } catch (TimeoutException e ) {
5154 Log .e ("FFmpeg binary timed out" , e );
52- return new CommandResult (false , e .getMessage ());
55+ ret = new CommandResult (false , e .getMessage ());
56+ outputStringBuilder .append (ret .output );
5357 } catch (Exception e ) {
5458 Log .e ("Error running FFmpeg binary" , e );
5559 } finally {
5660 Util .destroyProcess (process );
5761 }
58- return CommandResult .getDummyFailureResponse ();
62+ output = outputStringBuilder .toString ();
63+ return ret ;
5964 }
6065
6166 @ Override
@@ -68,7 +73,6 @@ protected void onProgressUpdate(String... values) {
6873 @ Override
6974 protected void onPostExecute (CommandResult commandResult ) {
7075 if (ffmpegExecuteResponseHandler != null ) {
71- output += commandResult .output ;
7276 if (commandResult .success ) {
7377 ffmpegExecuteResponseHandler .onSuccess (output );
7478 } else {
@@ -107,7 +111,7 @@ private void checkAndUpdateProcess() throws TimeoutException, InterruptedExcepti
107111 return ;
108112 }
109113
110- output += line + "\n " ;
114+ outputStringBuilder . append ( line ); outputStringBuilder . append ( "\n " ) ;
111115 publishProgress (line );
112116 }
113117 } catch (IOException e ) {
0 commit comments