mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-05-07 14:44:01 +00:00
feat(src/components/call/CallModel): add a cameraFirstFrameReceived
This commit is contained in:
parent
5c564b1f85
commit
711d1c66ca
4 changed files with 43 additions and 4 deletions
|
|
@ -104,6 +104,15 @@ void CallModel::updateStats (const shared_ptr<const linphone::CallStats> &callSt
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void CallModel::notifyCameraFirstFrameReceived (unsigned int width, unsigned int height) {
|
||||
if (mNotifyCameraFirstFrameReceived) {
|
||||
mNotifyCameraFirstFrameReceived = false;
|
||||
emit cameraFirstFrameReceived(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void CallModel::accept () {
|
||||
stopAutoAnswerTimer();
|
||||
|
||||
|
|
@ -231,10 +240,12 @@ void CallModel::handleCallStateChanged (const shared_ptr<linphone::Call> &call,
|
|||
break;
|
||||
|
||||
case linphone::CallStatePausedByRemote:
|
||||
mNotifyCameraFirstFrameReceived = true;
|
||||
mPausedByRemote = true;
|
||||
break;
|
||||
|
||||
case linphone::CallStatePausing:
|
||||
mNotifyCameraFirstFrameReceived = true;
|
||||
mPausedByUser = true;
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -98,6 +98,8 @@ public:
|
|||
static void setRecordFile (std::shared_ptr<linphone::CallParams> &callParams);
|
||||
void updateStats (const std::shared_ptr<const linphone::CallStats> &callStats);
|
||||
|
||||
void notifyCameraFirstFrameReceived (unsigned int width, unsigned int height);
|
||||
|
||||
Q_INVOKABLE void accept ();
|
||||
Q_INVOKABLE void acceptWithVideo ();
|
||||
Q_INVOKABLE void terminate ();
|
||||
|
|
@ -127,6 +129,8 @@ signals:
|
|||
void videoRequested ();
|
||||
void securityUpdated ();
|
||||
|
||||
void cameraFirstFrameReceived (unsigned int width, unsigned int height);
|
||||
|
||||
private:
|
||||
void handleCallStateChanged (const std::shared_ptr<linphone::Call> &call, linphone::CallState state);
|
||||
|
||||
|
|
@ -183,6 +187,8 @@ private:
|
|||
bool mPausedByUser = false;
|
||||
bool mRecording = false;
|
||||
|
||||
bool mNotifyCameraFirstFrameReceived = true;
|
||||
|
||||
QString mCallError;
|
||||
|
||||
QVariantList mAudioStats;
|
||||
|
|
|
|||
|
|
@ -104,8 +104,11 @@ void CameraRenderer::render () {
|
|||
|
||||
if (mIsPreview)
|
||||
coreManager->getCore()->previewOglRender();
|
||||
else if (mCall)
|
||||
else if (mCall) {
|
||||
mCall->oglRender();
|
||||
if (mNotifyReceivedVideoSize && notifyReceivedVideoSize())
|
||||
mNotifyReceivedVideoSize = false;
|
||||
}
|
||||
|
||||
msFunctions->bind(nullptr);
|
||||
coreManager->unlockVideoRender();
|
||||
|
|
@ -148,6 +151,26 @@ void CameraRenderer::updateWindowId () {
|
|||
mCall->setNativeVideoWindowId(mContextInfo);
|
||||
}
|
||||
|
||||
bool CameraRenderer::notifyReceivedVideoSize () const {
|
||||
shared_ptr<const linphone::VideoDefinition> videoDefinition = mCall->getCurrentParams()->getReceivedVideoDefinition();
|
||||
unsigned int width = videoDefinition->getWidth();
|
||||
unsigned int height = videoDefinition->getHeight();
|
||||
|
||||
if (width && height) {
|
||||
qInfo() << "Thread" << QThread::currentThread() << QStringLiteral("Received video size (width: %1, height: %2):")
|
||||
.arg(width).arg(height) << mContextInfo;
|
||||
|
||||
CallModel *callModel = &mCall->getData<CallModel>("call-model");
|
||||
QTimer::singleShot(0, callModel, [callModel, width, height] {
|
||||
callModel->notifyCameraFirstFrameReceived(width, height);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Camera::Camera (QQuickItem *parent) : QQuickFramebufferObject(parent) {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
// =============================================================================
|
||||
|
||||
class CallModel;
|
||||
class Camera;
|
||||
struct ContextInfo;
|
||||
|
||||
namespace linphone {
|
||||
|
|
@ -39,8 +38,6 @@ namespace linphone {
|
|||
}
|
||||
|
||||
class CameraRenderer : public QQuickFramebufferObject::Renderer {
|
||||
friend class Camera;
|
||||
|
||||
public:
|
||||
CameraRenderer ();
|
||||
~CameraRenderer ();
|
||||
|
|
@ -52,10 +49,12 @@ protected:
|
|||
|
||||
private:
|
||||
void updateWindowId ();
|
||||
bool notifyReceivedVideoSize () const;
|
||||
|
||||
ContextInfo *mContextInfo;
|
||||
bool mUpdateContextInfo = false;
|
||||
|
||||
bool mNotifyReceivedVideoSize = true;
|
||||
bool mIsPreview = false;
|
||||
std::shared_ptr<linphone::Call> mCall;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue