Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when using MJPEG in DirectShow UVC WebCams #92

Closed
evgeny-test opened this issue Dec 1, 2020 · 1 comment
Closed

Crash when using MJPEG in DirectShow UVC WebCams #92

evgeny-test opened this issue Dec 1, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@evgeny-test
Copy link

evgeny-test commented Dec 1, 2020

Modern webcams are able to get FullHD video. They usually encode it into a YUY2 or MJPEG, but the frame rate is very different.
For example for Creative Live! Cam Sync 1080p and Logitech HD Pro Webcam C920 and many other:
YUY2 1920x1080 5 fps
MJPEG 1920x1080 30 fps
Of course I would like to use MJPEG, but Linphone chooses YUY2 even if I set the priority setting for a high frame rate or 30 fps.
OK, I took Linphone Desktop branch 4.2.4 and edited the file \linphone-desktop\linphone-sdk\mediastreamer2\src\videofilters\msdscap.cc to increase the priority of MJPEG.

int DSCapture::selectBestFormat(SharedComPtr<IAMStreamConfig> streamConfig, int count){
	int index;

	_pixfmt=MS_MJPEG;   //Just moved MJPEG to the beginning
	index=find_best_format(streamConfig, count, &_vsize, _pixfmt);
	if (index!=-1) goto success;
	_pixfmt=MS_YUV420P;
	index=find_best_format(streamConfig, count, &_vsize, _pixfmt);
	if (index!=-1) goto success;
	_pixfmt=MS_YUY2;
	index=find_best_format(streamConfig, count, &_vsize,_pixfmt);
	if (index!=-1) goto success;
	_pixfmt=MS_YUYV;
	index=find_best_format(streamConfig, count, &_vsize, _pixfmt);
	if (index!=-1) goto success;
	_pixfmt=MS_RGB24;
	index=find_best_format(streamConfig, count, &_vsize, _pixfmt);
	if (index!=-1) {
		_pixfmt=MS_RGB24_REV;
		goto success;
	}
	ms_error("This camera does not support any of our pixel formats.");
	return -1;
...

I open the video settings window and click the view button.
Linphone selects MJPEG format, displays a black screen for 5 seconds and closes without reporting an error.
I have attached an extended log file for the described startup case: linphone1.log

I tried to debug the code myself but was not successful.

I can open a MJPEG video stream from my camera in some other programs and see a good FullHD video. For example, the Camera application from Windows 10.

Additionally, I want to say that I am using Windows 10 Pro 64 bit with last updates. I compile Linphone according to the official instructions and get binaries that are very similar to the original assembly. If I don't change the code, then the video plays, but 5 frames per second in YUY2. I've tried other video resolutions, but MJPEG doesn't work anyway.

Do you have the opportunity to look at MJPEG implementation again or help me fix this bug?

Thank you for any help and feedback!

@KyronNextLevel KyronNextLevel pinned this issue Jan 31, 2022
@KyronNextLevel KyronNextLevel added the enhancement New feature or request label Jan 31, 2022
@Ledjlale
Copy link
Contributor

DirectShow is deprecated. MSFoundation should be used instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants