diff --git a/src/media/video/video_receive_thread.cpp b/src/media/video/video_receive_thread.cpp index d3135d681711778d53465aea30c96458467005d6..b520a6e1828512aa70d0ab34f09c26f3ece60836 100644 --- a/src/media/video/video_receive_thread.cpp +++ b/src/media/video/video_receive_thread.cpp @@ -87,7 +87,7 @@ bool VideoReceiveThread::setup() dstWidth_ = args_.width; dstHeight_ = args_.height; - const std::string SDP_FILENAME = "dummyFilename"; + static const std::string SDP_FILENAME = "dummyFilename"; if (args_.input.empty()) { args_.format = "sdp"; args_.input = SDP_FILENAME; diff --git a/src/sip/sipvoiplink.cpp b/src/sip/sipvoiplink.cpp index c7f27d58617e4f0794ff05bac8288247b88b420a..a9a1166a7d4ec1c7b2ad1acc0cd657e700728e2c 100644 --- a/src/sip/sipvoiplink.cpp +++ b/src/sip/sipvoiplink.cpp @@ -952,26 +952,23 @@ handleMediaControl(SIPCall& call, pjsip_msg_body* body) /* Apply and answer the INFO request */ pj_strset(&control_st, (char *) body->data, body->len); - constexpr pj_str_t PICT_FAST_UPDATE = CONST_PJ_STR("picture_fast_update"); - constexpr pj_str_t DEVICE_ORIENTATION = CONST_PJ_STR("device_orientation"); + static constexpr pj_str_t PICT_FAST_UPDATE = CONST_PJ_STR("picture_fast_update"); + static constexpr pj_str_t DEVICE_ORIENTATION = CONST_PJ_STR("device_orientation"); if (pj_strstr(&control_st, &PICT_FAST_UPDATE)) { call.sendKeyframe(); return true; } else if (pj_strstr(&control_st, &DEVICE_ORIENTATION)) { - int rotation = 0; - std::string body_msg = control_st.ptr; + static const std::regex ORIENTATION_REGEX("device_orientation=([-+]?[0-9]+)"); + + std::string body_msg(control_st.ptr, control_st.slen); std::smatch matched_pattern; - std::regex str_pattern("device_orientation=([-+]?[0-9]+)"); + std::regex_search(body_msg, matched_pattern, ORIENTATION_REGEX); - std::regex_search(body_msg, matched_pattern, str_pattern); if (matched_pattern.ready() && !matched_pattern.empty() && matched_pattern[1].matched) { - rotation = std::stoi(matched_pattern[1]); - + int rotation = std::stoi(matched_pattern[1]); JAMI_WARN("Rotate video %d deg.", rotation); - call.getVideoRtp().setRotation(rotation); - return true; } }