Skip to content

Commit

Permalink
Merge pull request #683 from OpenHD/consti-dev
Browse files Browse the repository at this point in the history
Fix android crash on restart bug (audio)
  • Loading branch information
Consti10 authored Apr 8, 2024
2 parents 964c49d + 68a5013 commit 5565f22
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 3 deletions.
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

0 comments on commit 5565f22

Please sign in to comment.