diff --git a/coreapi/linphoneconference.c b/coreapi/linphoneconference.c index bb44f8471073b89b933a6c0570bebda07d7a420c..fec83cf2bce017c9f5ac540ffa15d896025c69bd 100644 --- a/coreapi/linphoneconference.c +++ b/coreapi/linphoneconference.c @@ -338,44 +338,6 @@ void linphone_conference_set_participant_admin_status (LinphoneConference *confe MediaConference::Conference::toCpp(conference)->setParticipantAdminStatus(p, !!isAdmin); } -void linphone_conference_preview_ogl_render(LinphoneConference *conference) { -#ifdef VIDEO_ENABLED - std::shared_ptr<MediaConference::Conference> cppConference = MediaConference::Conference::toCpp(conference)->getSharedFromThis(); - if (cppConference->isIn()) {// Ensure to be in conference - MS2VideoControl *control = dynamic_cast<MS2VideoControl*>(cppConference->getVideoControlInterface()); - if(control) { - VideoStream *stream = control->getVideoStream(); - if(stream && stream->output2 && ms_filter_get_id(stream->output2) == MS_OGL_ID) { - ms_filter_call_method(stream->output2, MS_OGL_RENDER, NULL); - } - if (stream && stream->output2) { - MSVideoDisplayMode mode = MSVideoDisplayHybrid; - ms_filter_call_method(stream->output2, MS_VIDEO_DISPLAY_SET_MODE, &mode); - } - } - } -#endif -} - -void linphone_conference_ogl_render(LinphoneConference *conference) { -#ifdef VIDEO_ENABLED - std::shared_ptr<MediaConference::Conference> cppConference = MediaConference::Conference::toCpp(conference)->getSharedFromThis(); - if (cppConference->isIn()) {// Ensure to be in conference - MS2VideoControl *control = dynamic_cast<MS2VideoControl*>(cppConference->getVideoControlInterface()); - if(control) { - VideoStream *stream = control->getVideoStream(); - if(stream && stream->output && ms_filter_get_id(stream->output) == MS_OGL_ID) { - ms_filter_call_method(stream->output, MS_OGL_RENDER, NULL); - } - if (stream && stream->output) { - MSVideoDisplayMode mode = MSVideoDisplayHybrid; - ms_filter_call_method(stream->output, MS_VIDEO_DISPLAY_SET_MODE, &mode); - } - } - } -#endif -} - LinphoneConferenceParams *linphone_conference_params_new (const LinphoneCore *core) { LinphoneConferenceParams *conference = ConferenceParams::createCObject(core); return conference; diff --git a/include/linphone/conference.h b/include/linphone/conference.h index 3d9774df6af1d79a7d98bc0ba49cc148e976b154..8faf73b324bb8cbe0701d0f0a532f4b2a0ad1914 100644 --- a/include/linphone/conference.h +++ b/include/linphone/conference.h @@ -514,18 +514,6 @@ LINPHONE_PUBLIC void *linphone_conference_get_user_data(const LinphoneConference **/ LINPHONE_PUBLIC void linphone_conference_set_user_data(LinphoneConference *conference, void *user_data); -/** - * Call generic OpenGL render preview for a given conference - * @param conference The #LinphoneConference object. @notnil - */ -LINPHONE_PUBLIC void linphone_conference_preview_ogl_render(LinphoneConference *conference); - -/** - * Call generic OpenGL render for a given conference - * @param conference The #LinphoneConference object. @notnil - */ -LINPHONE_PUBLIC void linphone_conference_ogl_render(LinphoneConference *conference); - /** * Change the admin status of a participant of a conference (you need to be an admin yourself to do this). * @param conference A #LinphoneConference object @notnil diff --git a/src/conference/session/media-session.cpp b/src/conference/session/media-session.cpp index 72e71045c7e8b35d0331c86e661c3ac751f0b797..ba31543ac39929f072bf000cdb872882c6642f28 100644 --- a/src/conference/session/media-session.cpp +++ b/src/conference/session/media-session.cpp @@ -4111,7 +4111,6 @@ void MediaSession::setNativeVideoWindowId(void *id, const std::string label) { } if (iface) { iface->setNativeWindowId(id); - iface->setDisplayMode(MSVideoDisplayHybrid); } } else { lError() << "Unable to set window ID because no video stream has been found with label " << searchedLabel; diff --git a/src/conference/session/ms2-streams.h b/src/conference/session/ms2-streams.h index a49ddf87dd376e17d8985e275d73a89e8bdb2627..3a313b0ade15d9ed7df24bc4610042221e0ee20b 100644 --- a/src/conference/session/ms2-streams.h +++ b/src/conference/session/ms2-streams.h @@ -240,7 +240,6 @@ public: virtual void setDeviceRotation(int rotation) override; virtual void getRecvStats(VideoStats *s) const override; virtual void getSendStats(VideoStats *s) const override; - virtual void setDisplayMode(MSVideoDisplayMode displayMode) override; virtual void onSnapshotTaken(const std::string &filepath) = 0; virtual VideoStream *getVideoStream()const = 0; diff --git a/src/conference/session/streams.h b/src/conference/session/streams.h index a49aec3042f37ff48352e2058d37551a595d3caf..5513a9b7880d4aab03ed758fd1bc395039b3e284 100644 --- a/src/conference/session/streams.h +++ b/src/conference/session/streams.h @@ -254,7 +254,6 @@ public: virtual void setDeviceRotation(int rotation) = 0; virtual void getRecvStats(VideoStats *s) const = 0; virtual void getSendStats(VideoStats *s) const = 0; - virtual void setDisplayMode(MSVideoDisplayMode displayMode) = 0; virtual ~VideoControlInterface() = default; }; diff --git a/src/conference/session/video-stream.cpp b/src/conference/session/video-stream.cpp index df1a484f111fa1251ef0aca92a4896b110360643..85b3bc7552f851cbf73a8dd3bbb4b17f4adce2cb 100644 --- a/src/conference/session/video-stream.cpp +++ b/src/conference/session/video-stream.cpp @@ -198,6 +198,19 @@ void MS2VideoStream::finishPrepare(){ video_stream_unprepare_video(mStream); } +MSVideoDisplayMode stringToVideoDisplayMode(const string& mode) { + if (mode.compare("Hybrid")==0) { + return MSVideoDisplayHybrid; + } else if (mode.compare("BlackBars")==0) { + return MSVideoDisplayBlackBars; + } else if (mode.compare("OccupyAllSpace")==0) { + return MSVideoDisplayOccupyAllSpace; + } else { + lWarning() << "Video stream set display mode " << mode << " failed, available values {Hybrid, BlackBars, OccupyAllSpace}."; + } + return MSVideoDisplayHybrid; +} + void MS2VideoStream::render(const OfferAnswerContext & ctx, CallSession::State targetState){ bool reusedPreview = false; CallSessionListener *listener = getMediaSessionPrivate().getCallSessionListener(); @@ -217,6 +230,7 @@ void MS2VideoStream::render(const OfferAnswerContext & ctx, CallSession::State t } bool basicChangesHandled = handleBasicChanges(ctx, targetState); + bool isThumbnail = (content.compare("thumbnail") == 0); if (basicChangesHandled) { bool muted = mMuted; @@ -231,7 +245,7 @@ void MS2VideoStream::render(const OfferAnswerContext & ctx, CallSession::State t } MediaStreamDir dir = media_stream_get_direction(&mStream->ms); - if (videoMixer == nullptr && !label.empty() && dir != MediaStreamRecvOnly && (content.compare("thumbnail") != 0)) { + if (videoMixer == nullptr && !label.empty() && dir != MediaStreamRecvOnly && !isThumbnail) { lInfo() << "Restarting stream because it has to be linked to ITC sink."; stop(); } else { @@ -333,8 +347,12 @@ void MS2VideoStream::render(const OfferAnswerContext & ctx, CallSession::State t video_stream_set_device_rotation(mStream, getCCore()->device_rotation); video_stream_set_freeze_on_error(mStream, !!linphone_config_get_int(linphone_core_get_config(getCCore()), "video", "freeze_on_error", 1)); video_stream_use_video_preset(mStream, linphone_config_get_string(linphone_core_get_config(getCCore()), "video", "preset", nullptr)); + if (isThumbnail) + video_stream_set_display_mode(mStream, stringToVideoDisplayMode(linphone_config_get_string(linphone_core_get_config(getCCore()), "video", "thumbnail_display_mode", "OccupyAllSpace"))); + else + video_stream_set_display_mode(mStream, stringToVideoDisplayMode(linphone_config_get_string(linphone_core_get_config(getCCore()), "video", "display_mode", "Hybrid"))); - video_stream_enable_thumbnail(mStream, (content.compare("thumbnail") == 0)); + video_stream_enable_thumbnail(mStream, isThumbnail); if (!label.empty()) { video_stream_set_label(mStream, label.c_str()); } @@ -363,7 +381,7 @@ void MS2VideoStream::render(const OfferAnswerContext & ctx, CallSession::State t io.output.type = (videoMixer == nullptr) ? MSResourceDefault : MSResourceVoid; } if (ok) { - if (videoMixer == nullptr && !label.empty() && dir == MediaStreamSendOnly && (content.compare("thumbnail") == 0)) { + if (videoMixer == nullptr && !label.empty() && dir == MediaStreamSendOnly && isThumbnail) { itcStream = getGroup().lookupItcStream(mStream); if (itcStream) { itcFilter = itcStream->itcsink; @@ -382,7 +400,7 @@ void MS2VideoStream::render(const OfferAnswerContext & ctx, CallSession::State t } else { video_stream_start_from_io(mStream, videoProfile, dest.rtpAddr.c_str(), dest.rtpPort, dest.rtcpAddr.c_str(), dest.rtcpPort, usedPt, &io); - if (videoMixer == nullptr && !label.empty() && dir != MediaStreamRecvOnly && (content.compare("thumbnail") != 0)) { + if (videoMixer == nullptr && !label.empty() && dir != MediaStreamRecvOnly && !isThumbnail) { link_video_stream_with_itc_sink(mStream); itcStream = getGroup().lookupItcStream(mStream); if (itcStream){ @@ -705,15 +723,6 @@ void MS2VideoControl::zoomVideo (float zoomFactor, float cx, float cy){ lWarning() << "Could not apply zoom: video output wasn't activated"; } -void MS2VideoControl::setDisplayMode(MSVideoDisplayMode displayMode) { - VideoStream *vs = getVideoStream(); - if (vs && vs->output) { - ms_filter_call_method(vs->output, MS_VIDEO_DISPLAY_SET_MODE, &displayMode); - } else { - lWarning() << "Could not set display mode: video output wasn't activated"; - } -} - LINPHONE_END_NAMESPACE