Skip to content
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

Update video handling in Android PJSUA2/SWIG sample apps #3673

Merged
merged 3 commits into from
Sep 12, 2023

Conversation

nanangizz
Copy link
Member

@nanangizz nanangizz commented Aug 29, 2023

The update includes:

  • simplify the code for readibility (combine surface callback handler for incoming video & local preview, remove show/hide preview button, etc)
  • remote video surface is shown after format change event (usually indication of first successful decoding) to avoid black/green screen
  • maintain video aspect ratio for both incoming video and local preview
  • add video capability in Kotlin sample app
  • add run-time Android permission check
  • update the Android build config version (gradle version, etc)

…ain aspect ratio, add video capability in Kotlin sample app, etc).
@nanangizz nanangizz changed the title Update video handling in Android sample apps Update video handling in Android PJSUA2/SWIG sample apps Aug 30, 2023
@nanangizz nanangizz added this to the release-2.14 milestone Aug 30, 2023
@sauwming
Copy link
Member

Bitrise fails to build, although it shows 404 everytime I click on it.

I tried to build the sample app locally and got a few build errors, such as:

pjsip-apps/src/swig/java/android/app/src/main/java/org/pjsip/pjsua2/app/MyApp.java:135: error: bad operand types for binary operator '&'
                if ((cmi.getDir() & pjmedia_dir.PJMEDIA_DIR_ENCODING) != 0) {
                                  ^

@nanangizz
Copy link
Member Author

Strange, it did not happen here, just retried on both Android Studio & SWIG make java.

Just in case, cmi.getDir() returns int here:

  public int getDir() {
    return pjsua2JNI.CallMediaInfo_dir_get(swigCPtr, this);
  }

And pjmedia_dir.PJMEDIA_DIR_ENCODING also int:

public final static int PJMEDIA_DIR_ENCODING = 1;

Could you check them on yours?

@nanangizz
Copy link
Member Author

Also the desktop CI Actions should also build the SWIG bindings including Java?

@sauwming
Copy link
Member

Ah, thanks for the pointer, there are conflicting definition on my workdir here, which doesn't get cleaned by make clean or realclean, so I remove it manually:

./pjsip-apps/src/swig/java/android/app/src/main/java/org/pjsip/pjsua2/CallMediaInfo.java:  public pjmedia_dir getDir() {
./pjsip-apps/src/swig/java/android/pjsua2/src/main/java/org/pjsip/pjsua2/CallMediaInfo.java:  public int getDir() {

The next problem I encountered is:
The project is using an incompatible version (AGP 7.4.2) of the Android Gradle plugin. Latest supported version is AGP 7.3.1
Which seems to require me to install a later version of Android Studio.
But changing it to 7.3.1 seems to work okay, so I suppose we should reduce the dependency requirement as minimal as possible.

Everything works fine here now.

@@ -373,6 +408,9 @@ public void init(MyAppObserver obs, String app_dir,
System.out.println(e);
}

// TCP & TLS transports with default SIP ports
// sometimes not working fine on Android somehow.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works fine on my device, so I have to uncomment it here.
Perhaps you can try using non-default ports rather than disabling this entirely?

@nanangizz
Copy link
Member Author

Re: gradle version. Not sure which gradle version should be used here, there are too many, checked the web it looks like the latest is 8.3, so 7.x actually sounds rather old already. Considering Android Studio is a bit aggressive in suggesting updates, I guess updating IDE/SDK/tools versions is like a daily routine for proper Android developers (definitely not me :D)

@sauwming
Copy link
Member

Everything looks okay to me, but the bitrise failure will need to be fixed.

@nanangizz nanangizz merged commit ad152c2 into master Sep 12, 2023
34 of 35 checks passed
@nanangizz nanangizz deleted the kotlin-sample branch September 12, 2023 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants