diff --git a/services/services/screen_capture/server/audio_capturer_wrapper.cpp b/services/services/screen_capture/server/audio_capturer_wrapper.cpp index 4c721c80e76954550392a466fec41d28af3c0063..d391cd966d27297f30ffadb3c986692c596715c4 100644 --- a/services/services/screen_capture/server/audio_capturer_wrapper.cpp +++ b/services/services/screen_capture/server/audio_capturer_wrapper.cpp @@ -131,7 +131,7 @@ std::shared_ptr AudioCapturerWrapper::CreateAudioCapturer(const O int32_t AudioCapturerWrapper::CaptureAudio() { MEDIA_LOGI("CaptureAudio start, threadName:%{public}s", threadName_.c_str()); - std::string name = threadName_.substr(0, std::min(threadName_.size(), (size_t)MAX_THREAD_NAME_LENGTH)); + std::string name = threadName_.substr(0, std::min(threadName_.size(), static_cast(MAX_THREAD_NAME_LENGTH))); pthread_setname_np(pthread_self(), name.c_str()); size_t bufferLen; diff --git a/services/services/screen_capture/server/audio_capturer_wrapper.h b/services/services/screen_capture/server/audio_capturer_wrapper.h index 5f67d250d4fce9f2c10bfcfab9c60c281b52cdf6..a4d3269851a1b684d6720a5e61b5cf9ff5b9e706 100644 --- a/services/services/screen_capture/server/audio_capturer_wrapper.h +++ b/services/services/screen_capture/server/audio_capturer_wrapper.h @@ -84,7 +84,7 @@ public: explicit MicAudioCapturerWrapper(AudioCaptureInfo &audioInfo, std::shared_ptr &screenCaptureCb, std::string &&name) : AudioCapturerWrapper(audioInfo, screenCaptureCb, std::move(name)) {} - ~MicAudioCapturerWrapper() {} + ~MicAudioCapturerWrapper() override {} protected: void OnStartFailed(ScreenCaptureErrorType errorType, int32_t errorCode) override; diff --git a/services/services/screen_capture/server/screen_capture_server.cpp b/services/services/screen_capture/server/screen_capture_server.cpp index b5a20e632dc758a22e463c6509450b0185fbbd17..b7d0dd59ce5e46c51c1fd8e9abad56b3d506ab49 100644 --- a/services/services/screen_capture/server/screen_capture_server.cpp +++ b/services/services/screen_capture/server/screen_capture_server.cpp @@ -349,12 +349,12 @@ int32_t ScreenCaptureServer::CheckVideoCapParam(const VideoCaptureInfo &videoCap MEDIA_LOGD("CheckVideoCapParam width:%{public}d, height:%{public}d, source:%{public}d, state:%{public}d", videoCapInfo.videoFrameWidth, videoCapInfo.videoFrameHeight, videoCapInfo.videoSource, videoCapInfo.state); if ((videoCapInfo.videoFrameWidth <= 0) || (videoCapInfo.videoFrameWidth > VIDEO_FRAME_WIDTH_MAX)) { - MEDIA_LOGE("videoCapInfo size is invalid, videoFrameWidth:%{public}d, videoFrameHeight:%{public}d", + MEDIA_LOGE("videoCapInfo Width is invalid, videoFrameWidth:%{public}d, videoFrameHeight:%{public}d", videoCapInfo.videoFrameWidth, videoCapInfo.videoFrameHeight); return MSERR_INVALID_VAL; } - if ((videoCapInfo.videoFrameWidth <= 0) || (videoCapInfo.videoFrameWidth > VIDEO_FRAME_HEIGHT_MAX)) { - MEDIA_LOGE("videoCapInfo size is invalid, videoFrameWidth:%{public}d, videoFrameHeight:%{public}d", + if ((videoCapInfo.videoFrameHeight <= 0) || (videoCapInfo.videoFrameHeight > VIDEO_FRAME_HEIGHT_MAX)) { + MEDIA_LOGE("videoCapInfo Height is invalid, videoFrameWidth:%{public}d, videoFrameHeight:%{public}d", videoCapInfo.videoFrameWidth, videoCapInfo.videoFrameHeight); return MSERR_INVALID_VAL; } @@ -405,6 +405,8 @@ int32_t ScreenCaptureServer::CheckVideoEncParam(const VideoEncInfo &videoEncInfo int32_t ScreenCaptureServer::CheckAudioCapInfo(AudioCaptureInfo &audioCapInfo) { if (audioCapInfo.audioChannels == 0 && audioCapInfo.audioSampleRate == 0) { + MEDIA_LOGD("audioCap IGNORED sampleRate:%{public}d, channels:%{public}d, source:%{public}d, state:%{public}d", + audioCapInfo.audioSampleRate, audioCapInfo.audioChannels, audioCapInfo.audioSource, audioCapInfo.state); audioCapInfo.state = AVScreenCaptureParamValidationState::VALIDATION_IGNORE; return MSERR_OK; } @@ -421,6 +423,8 @@ int32_t ScreenCaptureServer::CheckAudioCapInfo(AudioCaptureInfo &audioCapInfo) int32_t ScreenCaptureServer::CheckVideoCapInfo(VideoCaptureInfo &videoCapInfo) { if (videoCapInfo.videoFrameWidth == 0 && videoCapInfo.videoFrameHeight == 0) { + MEDIA_LOGD("videoCap IGNORED width:%{public}d, height:%{public}d, source:%{public}d, state:%{public}d", + videoCapInfo.videoFrameWidth, videoCapInfo.videoFrameHeight, videoCapInfo.videoSource, videoCapInfo.state); videoCapInfo.state = AVScreenCaptureParamValidationState::VALIDATION_IGNORE; return MSERR_OK; } @@ -602,7 +606,7 @@ int32_t ScreenCaptureServer::StartAudioCapture() CHECK_AND_RETURN_RET_LOG(ret == MSERR_OK, ret, "StartAudioCapture innerCapture failed"); } std::shared_ptr micCapture; - if (captureConfig_.audioInfo.innerCapInfo.state == AVScreenCaptureParamValidationState::VALIDATION_VALID) { + if (captureConfig_.audioInfo.micCapInfo.state == AVScreenCaptureParamValidationState::VALIDATION_VALID) { MediaTrace trace("ScreenCaptureServer::StartAudioCaptureMic"); micCapture = std::make_shared(captureConfig_.audioInfo.micCapInfo, screenCaptureCb_, std::string("OS_MicAudioCapture")); @@ -961,13 +965,13 @@ int32_t ScreenCaptureServer::StartScreenCaptureWithSurface(sptr surface int32_t ScreenCaptureServer::StartVideoCapture() { - if (captureConfig_.audioInfo.innerCapInfo.state == AVScreenCaptureParamValidationState::VALIDATION_IGNORE) { + if (captureConfig_.videoInfo.videoCapInfo.state == AVScreenCaptureParamValidationState::VALIDATION_IGNORE) { MEDIA_LOGI("StartVideoCapture is ignored"); return MSERR_OK; } CHECK_AND_RETURN_RET_LOG( - captureConfig_.audioInfo.innerCapInfo.state == AVScreenCaptureParamValidationState::VALIDATION_VALID, - MSERR_INVALID_VAL, "StartScreenCapture failed, invalid param, dataType:%{public}d", captureConfig_.dataType); + captureConfig_.videoInfo.videoCapInfo.state == AVScreenCaptureParamValidationState::VALIDATION_VALID, + MSERR_INVALID_VAL, "StartVideoCapture failed, invalid param, dataType:%{public}d", captureConfig_.dataType); int32_t ret = StartHomeVideoCapture(); CHECK_AND_RETURN_RET_LOG(ret == MSERR_OK, ret, @@ -1252,9 +1256,9 @@ int32_t ScreenCaptureServer::StopVideoCapture() MediaTrace trace("ScreenCaptureServer::StopVideoCapture"); MEDIA_LOGI("StopVideoCapture"); if ((screenId_ < 0) || (consumer_ == nullptr) || !isConsumerStart_) { - MEDIA_LOGI("StopVideoCapture failed, stop"); + MEDIA_LOGI("StopVideoCapture IGNORED, video capture not start"); surfaceCb_ = nullptr; - return MSERR_INVALID_OPERATION; + return MSERR_OK; } DestroyVirtualScreen();