Fix Openh264 for Android < 5.0
This commit is contained in:
parent
bb3ae4fbd2
commit
315c412776
5 changed files with 38 additions and 10 deletions
|
@ -98,6 +98,9 @@
|
|||
<string name="assistant_error_bad_credentials">Incorrect username or password</string>
|
||||
<string name="assistant_codec_down_question">Do you agree to download OpenH264 Video Codec provided by Cisco Systems, Inc.?</string>
|
||||
<string name="assistant_codec_downloading">Downloading OpenH264 Video Codec provided by Cisco Systems, Inc.</string>
|
||||
<string name="assistant_openh264_downloading">Downloading OpenH264</string>
|
||||
<string name="assistant_openh264_restart">Before use OpenH264 codec you must restart %s.</string>
|
||||
<string name="assistant_openh264_error">Sorry an error has occurred.</string>
|
||||
<string name="assistant_codec_downloaded">OpenH264 Video Codec provided by Cisco Systems, Inc. downloaded.</string>
|
||||
<string name="wizard_failed">An error occurred, try again later.</string>
|
||||
<string name="wizard_server_unavailable">Server unreachable, verify your network connection.</string>
|
||||
|
|
|
@ -243,14 +243,14 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
progress.setCancelable(false);
|
||||
progress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
|
||||
} else if (current <= max) {
|
||||
progress.setMessage("Downloading OpenH264");
|
||||
progress.setMessage(getString(R.string.assistant_openh264_downloading));
|
||||
progress.setMax(max);
|
||||
progress.setProgress(current);
|
||||
progress.show();
|
||||
} else {
|
||||
progress.dismiss();
|
||||
progress = null;
|
||||
LinphoneManager.getLc().reloadMsPlugins(null);
|
||||
LinphoneManager.getLc().reloadMsPlugins(LinphoneManager.this.getContext().getApplicationInfo().nativeLibraryDir);
|
||||
if (ohcodec.getUserDataSize() > box && ohcodec.getUserData(box) != null) {
|
||||
((CheckBoxPreference) ohcodec.getUserData(box)).setSummary(mCodecDownloader.getLicenseMessage());
|
||||
((CheckBoxPreference) ohcodec.getUserData(box)).setTitle("OpenH264");
|
||||
|
@ -267,9 +267,9 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
public void run() {
|
||||
if (progress != null) progress.dismiss();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder((Context) LinphoneManager.getInstance().getOpenH264DownloadHelper().getUserData(ctxt));
|
||||
builder.setMessage("Sorry an error has occurred.");
|
||||
builder.setMessage(getString(R.string.assistant_openh264_error));
|
||||
builder.setCancelable(false);
|
||||
builder.setNeutralButton("Ok", null);
|
||||
builder.setNeutralButton(getString(R.string.ok), null);
|
||||
builder.show();
|
||||
}
|
||||
});
|
||||
|
@ -316,8 +316,10 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
instance = new LinphoneManager(c);
|
||||
instance.startLibLinphone(c);
|
||||
|
||||
if (getLc().openH264Enabled()) {
|
||||
// H264 codec Management - set to auto mode -> MediaCodec >= android 5.0 >= OpenH264
|
||||
H264Helper.setH264Mode(H264Helper.MODE_AUTO, getLc());
|
||||
}
|
||||
TelephonyManager tm = (TelephonyManager) c.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
boolean gsmIdle = tm.getCallState() == TelephonyManager.CALL_STATE_IDLE;
|
||||
setGsmIdle(gsmIdle);
|
||||
|
@ -938,6 +940,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
}
|
||||
finally {
|
||||
mServiceContext.unregisterReceiver(mKeepAliveReceiver);
|
||||
mServiceContext.unregisterReceiver(mDozeReceiver);
|
||||
mLc = null;
|
||||
instance = null;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import android.app.AlarmManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.*;
|
||||
|
@ -25,8 +27,10 @@ import org.json.JSONArray;
|
|||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.linphone.LinphoneActivity;
|
||||
import org.linphone.LinphoneLauncherActivity;
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.LinphoneService;
|
||||
import org.linphone.LinphoneUtils;
|
||||
import org.linphone.LinphonePreferences.AccountBuilder;
|
||||
import org.linphone.R;
|
||||
|
@ -669,6 +673,18 @@ private static AssistantActivity instance;
|
|||
}
|
||||
}
|
||||
|
||||
public void restartApplication() {
|
||||
mPrefs.firstLaunchSuccessful();
|
||||
|
||||
Intent mStartActivity = new Intent(this, LinphoneLauncherActivity.class);
|
||||
PendingIntent mPendingIntent = PendingIntent.getActivity(this, (int) System.currentTimeMillis(), mStartActivity, PendingIntent.FLAG_CANCEL_CURRENT);
|
||||
AlarmManager mgr = (AlarmManager)this.getSystemService(Context.ALARM_SERVICE);
|
||||
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 500, mPendingIntent);
|
||||
|
||||
stopService(new Intent(Intent.ACTION_MAIN).setClass(this, LinphoneService.class));
|
||||
android.os.Process.killProcess(android.os.Process.myPid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
if(status.equals(LinphoneAccountCreator.Status.AccountExistWithAlias)){
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.linphone.core.PayloadType;
|
|||
import org.linphone.tools.OpenH264DownloadHelper;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -82,10 +83,15 @@ public class CodecDownloaderFragment extends Fragment {
|
|||
bar.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
hideAllItems();
|
||||
LinphoneManager.getLc().reloadMsPlugins(null);
|
||||
downloaded.setVisibility(View.VISIBLE);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||
enabledH264(true);
|
||||
LinphoneManager.getLc().reloadMsPlugins(AssistantActivity.instance().getApplicationInfo().nativeLibraryDir);
|
||||
AssistantActivity.instance().endDownloadCodec();
|
||||
} else {
|
||||
// We need to restart due to bad android linker
|
||||
AssistantActivity.instance().restartApplication();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 517bca8d18b340cceadd8b82f7e5a98b40992c1b
|
||||
Subproject commit 3cfab1c16d541a5a4c497d7dd39193ec0e8e0dce
|
Loading…
Reference in a new issue