Commit Graph

829 Commits

Author SHA1 Message Date
Ximin Luo
020fd01b76 Fix manpage typo 2016-10-23 20:40:03 +02:00
Joseph Heenan
0e6b46db4d Merge pull request #230 from slokhorst/system-bswap
Use system-provided bswap and uint32_t
release-4.0
2016-10-16 19:53:19 +01:00
MrDave
5831cce91a Revise version number to 4.0+githash 2016-10-14 22:34:33 -06:00
MrDave
a5d1f299b5 Version 4.0 2016-10-14 22:30:56 -06:00
Mr-Dave
dc102a0662 Merge pull request #232 from jogu/master
Fixes for various threading related crashes with rtsp netcams
2016-10-14 22:08:18 -06:00
Joseph Heenan
36f1466c6b Replace abort on ffmpeg lock registration fail with exit 2016-10-13 15:53:35 +01:00
Joseph Heenan
4051a468dc Remove now unnecessary FFMPEG ifdefs in netcam_next_rtsp 2016-10-13 15:53:35 +01:00
Joseph Heenan
80e5a31210 Ensure netcam receive buffers are large enough to hold resized image
The user might have configured an image size that's bigger than the
image received from the netcam, so our buffers need to be big enough.
2016-10-13 15:53:35 +01:00
Joseph Heenan
71d5dc2ad6 Refactor netcam_check_buffsize & netcam_buffsize_rtsp
Functions are identical, so combine them.
2016-10-13 15:53:35 +01:00
Joseph Heenan
585416a691 Fix for crash due to calling netcam_rtsp_open_sws with zero image size
If we don't manage to get a valid image size from the camera during
connection, disconnect and try again.
2016-10-12 08:21:52 +01:00
Joseph Heenan
a8b588df61 netcam resize fix: set buffer size correctly 2016-10-12 08:21:52 +01:00
Joseph Heenan
536027127f Add missing 'const' to recent IPv6 fixes
Produces a warning in developer builds otherwise
2016-10-12 08:21:28 +01:00
Joseph Heenan
07ca4f18d3 Fix for crashes in rtsp netcam resize code
The current code resulted in the motion_loop thread accessing (and
writing to) variables that should only be accessed in the
netcam_handler_loop thread, meaning we could see crashes.

We also introduce the necessary mutex around the remaining variables
in netcam_read_rtsp_image so:

a) we can be sure the netcam won't mess with the image buffer whilst
we're reading it
b) that any new image in 'latest' has actually been passed across the
threads and isn't lying in a register/CPU cache somewhere.

As per https://github.com/Motion-Project/motion/issues/224 the probem
code has been moved onto the netcam thread where it should be safe.

Nominally this may be less efficient (as we will resize every frame,
but motion_loop may process only some of those frames); in the long term
it may well be better to have the netcam_handler_loop send a full "image"
structure to the motion_loop thread (ie. including size and format
information), which the motion_loop thread would then be able to safely
resize.

Fixes #207
Fixes #224
2016-10-12 08:21:28 +01:00
Joseph Heenan
4d07c31cf1 Fix two typos 2016-10-12 08:21:28 +01:00
Joseph Heenan
90f1cc2fea Refactoring: common up netcam 'publish image' code
These fragments are all essentially identical so lift them out into a
new common function, netcam_image_read_complete().
2016-10-12 08:21:28 +01:00
Joseph Heenan
6f76d55db2 Tidy up netcam_rtsp.h
- place lines not affected by HAVE_FFMPEG outside the ifdef
- add include guards (for consistency with other .h files)
2016-10-12 08:21:28 +01:00
Joseph Heenan
80e78f559b Add threadname to logging output
As the logging currently is, you can't see whether log messages came
from the netcam thread or the motion loop thread, and messages that
come from the ffmpeg thread appear to come from the main thread. This
makes debugging based on the log messages error prone at best.

As an added bonus any camera name is now included.
2016-10-12 08:21:28 +01:00
Joseph Heenan
8323227e9f Change ffmpeg locking to use av_lockmgr_register etc
We now use ffmpeg's built in support for locking instead of trying to
lock ourselves before calling ffmpeg.

This may solve some race condition crashes.

Fixes #206
2016-10-12 08:21:27 +01:00
Joseph Heenan
8372f591e1 Cleanup avformat_network_init/deinit calls
avformat_network_init only needs to be called once on startup and once
on shutdown.

The functions aren't thread safe, and we can't fix that by protecting
them with the 'global_lock' as other functions in ffmpeg that we call
and that access the same data are not protected by the global_lock
(and can't be protected by that lock).

Fixes #194 - the particular issue we're seeing there is something like:

thread 1: lock mutex
thread 1: deinit network
thread 1: init network
thread 1: unlock mutex

thread 2: lock mutex
thread 2: deinit network

thread 1: call into an ffmpeg operation
thread 1: ffmpeg complains "init network" not called
2016-10-12 08:20:50 +01:00
MrDave
7f6db2ee4f Revise the netcam_interupt
The original netcam_interupt disregarded interupts from the
connection routines which occasionally caused problems with
camera reconnections.

Also included is a change to use a enum and consolidation to
only use the status instead of two separate variables.
2016-10-12 08:19:58 +01:00
Mr-Dave
0b28e16b1b Merge pull request #228 from Mr-DaveDev/issue-226
Closes Issue 226
2016-10-11 20:45:25 -06:00
MrDave
4afbfd2c68 typo fix 2016-10-11 07:32:50 -06:00
Sebastiaan Lokhorst
7ab010ebfc Add macOS bswap alternative. 2016-10-11 13:26:37 +02:00
Sebastiaan Lokhorst
aea61b7360 Use system-provided (glibc/FreeBSD) bswap function and uint32_t
Fix C11 (gnu11) build
2016-10-10 23:08:58 +02:00
MrDave
987b5e5862 Add quality default for h264
This commit adds a default crf of 28 for the h264 codecs when
the user has not selected any option.
2016-10-09 16:01:00 -06:00
MrDave
e2d3e14180 pts change for libav
The presentation time stamp(pts) indicates the time which the movie
player should display a particular frame.  In the previous changes
to the pts, we set the time basis to be in microseconds by specifying
the denomintor to be equal to 1000.  This allows for additional precision
when we assign the pts when writing the frame.  For the libav variant
the time basis assignment is ignored and instead the framerate is
used.  The use of the framerate causes problems when it is small.
At 2fps, time intervals of 1 to 499 microseconds round to a pts
of zero, 500 to 1499 microseconds round to pts 1, etc.  This
commit adds a variable to keep track of the last pts used in writing
the frame.  If the newly calculated pts is not greater than the previous
pts, we just increment the pts by 1 which would be the full 1/framerate
increment.  This could result visually twitchy videos at low framerates.
It could also have a compounding affect of eliminating the handling of
variable framerates and just fallback to a constant framerate video.
2016-10-09 14:23:58 -06:00
Joseph Heenan
c27023b7bd Merge pull request #218 from slokhorst/ipv6-optional
Put back option to disable IPv6
2016-10-09 10:27:16 +01:00
Sebastiaan Lokhorst
2984a15e29 Put back option to disable IPv6 2016-10-08 23:34:08 +02:00
Mr-Dave
c1e9024c76 Merge pull request #220 from Mr-DaveDev/makefile-fix
Makefile Revision for readme
2016-10-03 21:58:45 -06:00
MrDave
ff918f8276 Rename the README in the Makefile.in 2016-10-03 21:52:06 -06:00
Joseph Heenan
4dadd7920b Merge pull request #216 from Mr-DaveDev/readme-update
Readme update
2016-10-03 08:43:48 +01:00
Joseph Heenan
eaf47a5268 Merge pull request #215 from Mr-DaveDev/motion-guide
Motion Guide Update
2016-10-03 08:42:45 +01:00
Joseph Heenan
0421eb26aa Merge pull request #214 from Mr-DaveDev/manual-update
Manual update
2016-10-03 08:34:53 +01:00
Joseph Heenan
2d471f49df Merge pull request #213 from Mr-DaveDev/makefile-sed
Alternative sed option to not create bak files
2016-10-03 08:33:13 +01:00
MrDave
a8ec3baf5a Add travis-ci status to README.md 2016-10-02 21:09:09 -06:00
MrDave
76e24d986b Typo and content updates to README.md 2016-10-02 20:14:13 -06:00
MrDave
0cb5f5e2df Updated README.md 2016-10-02 19:55:35 -06:00
MrDave
4137ac563c Add force option to the mv on the sed result 2016-10-02 19:50:07 -06:00
MrDave
d7bcd32a81 Update to CHANGELOG 2016-10-02 18:31:37 -06:00
MrDave
8c686ec2b2 Add camera name format specifier 2016-10-02 18:17:08 -06:00
MrDave
8ff9153b07 Update to motion_guide.html
1.  Updated motion_guide.html to reflect current options
2.  Consolidated/Revised some of the header/lists to be simpler
3.  Added the configuration option history by version cross-walk
2016-10-02 18:07:52 -06:00
MrDave
2c87bf136d Additional config options for motion.1 2016-09-30 20:00:00 -06:00
MrDave
5f710c4e68 Trailing whitespace cleanup on motion.1
No changes to document except for elimination of trailing
whitespace removal.
2016-09-30 19:56:00 -06:00
MrDave
458dc112a2 Alternative sed option to not create bak files
The bsd compile pull revised the sed option to use -i.bak but
this left behind bak files.  This alternative was found that was
indicated to also be compatible without leaving bak files.
2016-09-30 19:49:15 -06:00
Mr-Dave
d8524bf3e8 Merge pull request #211 from slokhorst/fix-freebsd
Fix FreeBSD build
2016-09-30 18:36:52 -06:00
Mr-Dave
d168b294ea Merge pull request #209 from slokhorst/netcam-ipv6
Update netcam code to be IPv6 compatible
2016-09-30 18:36:32 -06:00
Sebastiaan Lokhorst
72eccf1b58 Fix FreeBSD build
Update FreeBSD instructions.
2016-09-29 20:00:37 +02:00
Sebastiaan Lokhorst
5827d9f450 Update netcam code to be IPv6 compatible 2016-09-29 15:13:58 +02:00
Joseph Heenan
12fdac8867 Merge pull request #208 from slokhorst/close-sock-on-fail
Reuse socket when still open, properly close on error
2016-09-29 13:22:39 +01:00
Sebastiaan Lokhorst
4b3bc5fc44 Reuse socket when it's still open. Properly close socket when binding/listening fails. 2016-09-29 14:16:32 +02:00