mirror of
https://github.com/Motion-Project/motion.git
synced 2026-06-12 07:44:34 -04:00
Implement modulo 16 for netcams to avoid seg fault in stream
This commit is contained in:
@@ -85,6 +85,7 @@ Features
|
||||
* Revise version.sh to put out the git commit.
|
||||
* Rollback revision to allow for a formal pull request.
|
||||
* Reimplement changes not to be included in pull request from tosiara commit 9ebee031
|
||||
* Implement requirement of modulo 16 to avoid seg fault when opening stream
|
||||
|
||||
Bugfixes
|
||||
* Avoid segfault detecting strerror_r() version GNU or SUSv3. (Angel Carpintero)
|
||||
|
||||
8
netcam.c
8
netcam.c
@@ -2909,15 +2909,15 @@ int netcam_start(struct context *cnt)
|
||||
* Motion currently requires that image height and width is a
|
||||
* multiple of 16. So we check for this.
|
||||
*/
|
||||
if (netcam->width % 8) {
|
||||
if (netcam->width % 16) {
|
||||
MOTION_LOG(CRT, TYPE_NETCAM, NO_ERRNO, "%s: netcam image width (%d)"
|
||||
" is not modulo 8", netcam->width);
|
||||
" is not modulo 16", netcam->width);
|
||||
return -3;
|
||||
}
|
||||
|
||||
if (netcam->height % 8) {
|
||||
if (netcam->height % 16) {
|
||||
MOTION_LOG(CRT, TYPE_NETCAM, NO_ERRNO, "%s: netcam image height (%d)"
|
||||
" is not modulo 8", netcam->height);
|
||||
" is not modulo 16", netcam->height);
|
||||
return -3;
|
||||
}
|
||||
|
||||
|
||||
@@ -850,6 +850,20 @@ int netcam_setup_rtsp(netcam_context_ptr netcam, struct url_t *url){
|
||||
netcam->rtsp->readingframe = 0;
|
||||
netcam->rtsp->status = RTSP_NOTCONNECTED;
|
||||
|
||||
/*
|
||||
* Warn and fix dimensions as needed.
|
||||
*/
|
||||
if (netcam->cnt->conf.width % 16) {
|
||||
MOTION_LOG(CRT, TYPE_NETCAM, NO_ERRNO, "%s: Image width (%d) requested is not modulo 16.", netcam->cnt->conf.width);
|
||||
netcam->cnt->conf.width = netcam->cnt->conf.width - (netcam->cnt->conf.width % 16) + 16;
|
||||
MOTION_LOG(CRT, TYPE_NETCAM, NO_ERRNO, "%s: Adjusting width to next higher multiple of 16 (%d).", netcam->cnt->conf.width);
|
||||
}
|
||||
if (netcam->cnt->conf.height % 16) {
|
||||
MOTION_LOG(CRT, TYPE_NETCAM, NO_ERRNO, "%s: Image height (%d) requested is not modulo 16.", netcam->cnt->conf.height);
|
||||
netcam->cnt->conf.height = netcam->cnt->conf.height - (netcam->cnt->conf.height % 16) + 16;
|
||||
MOTION_LOG(CRT, TYPE_NETCAM, NO_ERRNO, "%s: Adjusting height to next higher multiple of 16 (%d).", netcam->cnt->conf.height);
|
||||
}
|
||||
|
||||
av_register_all();
|
||||
avformat_network_init();
|
||||
avcodec_register_all();
|
||||
|
||||
Reference in New Issue
Block a user