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

Fix android crash on restart bug (audio) #683

Merged
merged 4 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions QOpenHD.pro
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ QT +=core quick qml gui \
widgets
QT += opengl
QT += charts
#QT += gui-private
#LIBS += Ldrm

INCLUDEPATH += $$PWD/lib
INCLUDEPATH += $$PWD/app
Expand Down
37 changes: 37 additions & 0 deletions app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ RESOLVEFUNC(SSL_get1_peer_certificate);
RESOLVEFUNC(EVP_PKEY_get_base_id);
#endif // OPENSSL_VERSION_MAJOR >= 3

//#include <qpa/qplatformnativeinterface.h>
//#include <xf86drm.h>
//#include <xf86drmMode.h>

// Load all the fonts we use ?!
static void load_fonts(){
Expand Down Expand Up @@ -197,6 +200,39 @@ static void android_check_permissions(){
#endif
}

/*static void debug_kms(){
qDebug()<<"platform name:"<<QGuiApplication::platformName();
if(QGuiApplication::platformName().contains("eglfs", Qt::CaseInsensitive)){
int fd = 0;
uint32_t crtc = 0;
uint32_t connector = 0;
bool useatomic = false;
auto * pni = QGuiApplication::platformNativeInterface();
QScreen *qScreen=QGuiApplication::primaryScreen();
auto * drifd = pni->nativeResourceForIntegration("dri_fd");
if (drifd)
fd = static_cast<int>(reinterpret_cast<qintptr>(drifd));
auto * crtcid = pni->nativeResourceForScreen("dri_crtcid", qScreen);
if (crtcid)
crtc = static_cast<uint32_t>(reinterpret_cast<qintptr>(crtcid));
auto * connid = pni->nativeResourceForScreen("dri_connectorid", qScreen);
if (connid)
connector = static_cast<uint32_t>(reinterpret_cast<qintptr>(connid));
auto * atomic = pni->nativeResourceForIntegration("dri_atomic_request");
if (atomic){
//auto * request = reinterpret_cast<drmModeAtomicReq*>(atomic);
auto * request = atomic;
if (request != nullptr)
useatomic = true;
}
qDebug()<<QString("%1 Qt EGLFS/KMS Fd:%2 Crtc id:%3 Connector id:%4 Atomic: %5")
.arg("xx").arg(fd).arg(crtc).arg(connector).arg(useatomic);
}else{
qDebug()<<"No eglfs";
}
}*/


int main(int argc, char *argv[]) {

QCoreApplication::setOrganizationName("OpenHD");
Expand Down Expand Up @@ -438,6 +474,7 @@ int main(int argc, char *argv[]) {
MavlinkTelemetry::instance().start();

QRenderStats::instance().register_to_root_window(engine);
//debug_kms();
LogMessagesModel::instanceGround().addLogMessage("QOpenHD","running");
const int retval = app.exec();
// Terminating needs a bit of special care due to the singleton usage and threads
Expand Down
6 changes: 5 additions & 1 deletion app/videostreaming/vscommon/audio_playback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@

void platform_start_audio_streaming_if_enabled()
{
if(QOpenHD::instance().is_android()){
// audio r.n crashes on android
return;
}
QSettings settings;
const bool dev_enable_live_audio_playback=settings.value("dev_enable_live_audio_playback", false).toBool();
const bool dev_enable_live_audio_playback=settings.value("dev_enable_live_audio_playback", true).toBool();
if(!dev_enable_live_audio_playback){
qDebug()<<"Live audio playback is disabled";
return;
Expand Down
2 changes: 1 addition & 1 deletion systemd/h264_decode.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Description=rock_h264_decode
[Service]
User=root

# Video decode via mpp, started by QOpenHD if needed (and stopped if needed)
# Platform-specific video decode service
ExecStart=/usr/local/bin/h264_decode.sh

Restart=always
Expand Down
2 changes: 1 addition & 1 deletion systemd/h265_decode.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Description=rock_h265_decode
[Service]
User=root

# Video decode via mpp, started by QOpenHD if needed (and stopped if needed)
# Platform-specific video decode service
ExecStart=/usr/local/bin/h265_decode.sh

Restart=always
Expand Down
Loading