Commit Graph

96 Commits

Author SHA1 Message Date
Jingyang Kang 4027590fcb Migrate to pion/webrtc/v4 (#592) 2024-12-10 14:12:02 +09:00
Valentin Cocaud 2882fd42d5 use thread safe atomic bool 2023-09-20 15:46:33 -04:00
Valentin Cocaud 694b4abd83 fix ForceKeyFrame signature for VP8 2023-09-20 15:46:33 -04:00
Valentin Cocaud afb2f78e3c force key frame implementation for vaapi 2023-09-20 15:46:33 -04:00
Abdarrakhman Akhmetgali dbd37689e4 Optimize ToI420 conversion by using sync.Pool (#473)
Added sync.Pool to the i420 conversion to minimize overhead of creating new byte slices
2023-03-06 15:53:44 -05:00
Atsushi Watanabe 58dc90d03a Fix opus codec panic on read after close (#440)
Also add test to other codecs
2022-08-24 07:23:57 -04:00
Eric Daniels 5215057409 Update libopus static library to correct arch for darwin arm64 (#428) 2022-08-07 09:01:29 -04:00
Valentin Cocaud 2a04a14225 rename opus C function to be compatible with other opus modules (#425) 2022-08-03 17:14:36 +02:00
Valentin Cocaud cd6aaa1393 Force key frame on PLI
Also make the ReadCloser an Controllable allows to uncouple
the controller implementation from the encoder.
This is not needed for the 2 codec controller already implemented (openh264 and vpx)
but is more future proof in case it required for other codecs.
2022-07-25 10:51:35 -04:00
adamroach 82cc32308b Enable configuration of OpenH264 Encoder (#409)
There's been a long-standing TODO comment in the bridge for OpenH264 to
remove hardcoding for the set of configurable parameters exposed by that
library. That patch does exactly that.
2022-07-06 23:58:56 -05:00
代码人生 e371c0d955 fix: Fix compilation error on arm64 Mac (#404) 2022-06-02 18:41:39 +08:00
Atsushi Watanabe f0ff9261b4 Add darwin arm64 libs (#368)
Add opus and openh264 for arm64

Co-authored-by: Atsushi Watanabe <atsushi.w@ieee.org>
Co-authored-by: Earther <qn.khuat@gmail.com>
2022-05-02 11:44:46 +09:00
代码人生 e780bdc6f9 Implement forced keyframes for x264 (#388)
* Implement forced keyframes for x264

* format code
2022-04-05 13:12:24 +08:00
代码人生 ff18b21629 Fix OpenH264 keyframe generation method (#387)
* Fix OpenH264 keyframe generation method

* Fix : fix variable reference error
2022-04-05 13:12:07 +08:00
adamroach 9bb5755cd2 Fixing Stride Handling for OpenH264 (#381)
The golang image.YCbCr struct can contain fields of arbitrary stride
lengths, which don't necessarily match the field widths. This
patch passes the stride values from the image.YCbCr struct into
the OpenH264 encode calls.
2022-03-08 03:09:01 -06:00
Atsushi Watanabe a88c2daf89 Allow double close of codecs (#364)
Video/AudioTrack.NewRTPReader() internally closes encoder on error.
It caused double free if user closes reader after error.
2021-11-21 22:57:50 +09:00
Atsushi Watanabe 1f313a9d61 Add simple read test to codecs (#367) 2021-11-20 15:42:24 +09:00
Valentin Cocaud 3a04686875 Implements RequireKeyFrame for VPX codec (#334) 2021-06-12 11:28:59 -07:00
Atsushi Watanabe d71b72c64d Fix audio codec latency handling (#317)
To avoid buffering audio data multiple times, remove buffer from
malgo audio driver and pass expected codec latency as a codec
parameter.
2021-03-25 14:09:57 -07:00
Patryk Rogalski b863c105c8 Implemented ForceKeyFrame for openh264 encoder (#319) 2021-03-12 15:26:30 -08:00
Lukas Herman ca4116b5ce Recompile Opus with PIC
Resolves https://github.com/pion/mediadevices/issues/284
2021-01-09 08:30:52 -08:00
Atsushi Watanabe 8a4e0779d7 Add test for vpx input image size change 2021-01-08 15:08:13 +09:00
f-fl0 c56cc487a3 Fix VPX_CODEC_INVALID_PARAM on resolution change (#283)
* Fix VPX_CODEC_INVALID_PARAM on resolution change
  - When chaning resolution to a larger one,
    vpx_codec_enc_config_set fails with VPX_CODEC_INVALID_PARAM.
  - Creating a new codec object seems to be necessary.
* Address PR comments
  - Free encoder old codec.
2021-01-08 12:19:14 +09:00
Lukas Herman 0b1a19f343 Enhance build system by switching to Makefile
By switching to Makefile, parallel builds and single build are now
possible.

Examples:

  Parallel Build:
    make -j

  Single Build:
    make opus-darwin-x64

Also, since Makefile has a dependency change detection feature, the
build time is reduced significantly when there are only a few things that
change, Makefile will not rebuild everything unnecessarily.
2020-12-18 22:55:45 -05:00
Lukas Herman d84d0a3b0c Upgrade pion/webrtc from v2 to v3
With webrtc v3, users no longer need to bind or unbind manually anymore.

Changes:
  * Switch from webrtc.RTPCodec to webrtc.RTPCodecParameters
  * Fix broken examples after the upgrade
  * NewRTPReader now accepts ssrc as a parameter
  * Track interface now fulfills webrtc.TrackLocal requirements
2020-12-18 14:33:42 -05:00
Lukas Herman 76908aca89 Disable stack protection in opus 2020-12-17 19:01:19 -05:00
Lukas Herman f3ac1f5480 Add static-linked opus option
Changes:
  * Remove hraban/opus dependency
  * Add multiple static-linked libopus binaries
2020-12-16 19:04:12 -05:00
Lukas Herman 1b5203d3a0 Enhance cross-platform build system (#266)
With this new build system, it'll make it easier to compile third-party
libraries statically to multiple platforms.
2020-12-15 14:13:12 -05:00
Lukas Herman 356eee19ce Remove pkg-config requirement for mmal 2020-11-21 20:57:26 +00:00
Lukas Herman a8dbecff30 Fix crash in x264 encoder close 2020-11-21 11:42:21 -08:00
Lukas Herman d65170dfe3 Fix wrong duration in vpx due to buffer usage
VPX doesn't allow 0 duration. If 0 is given, vpx_codec_encode will fail with VPX_CODEC_INVALID_PARAM.
0 duration is possible because mediadevices first gets the frame meta data by reading from the source,
and consequently the codec will read the first frame from the buffer. This means the first frame won't
have a pause to the second frame, which means if the delay is <1 ms (vpx duration resolution), duration
is going to be 0.
2020-11-09 22:16:23 -08:00
Lukas Herman f396092609 Default high profile for x264 when possible 2020-11-01 01:08:03 -07:00
Lukas Herman 559c6a13a1 Update readers to be memory pool friendly 2020-10-29 00:04:12 -07:00
Lukas Herman f4a4edcabd Update codec.Reader interface to return byte slice 2020-10-29 04:48:47 +00:00
Lukas Herman 4f9822349a Add mmal hardware video encoder support
Using mmal significantly boosts video fps by offloading the encoding
work from CPU to GPU. On a Raspberry Pi 3, libx264 only gives 480p18,
whereas mmal can give 720p30.
2020-10-27 21:08:12 -07:00
Lukas Herman 9dcfaf1c1e Switch from type alias to embedded struct
Embedded struct provides more future compatibility
2020-10-11 23:32:58 -04:00
Lukas Herman abdd96e6b2 Replace Name with RTPCodec in codec builder
Allowing users to implement RTPCodec will give users freedom to have
a custom encoder with custom RTP payload.
2020-10-08 11:33:38 -04:00
Lukas Herman 5703fd7e4b Remove webrtc dependency in codec and its sub packages 2020-10-05 22:23:52 -04:00
Atsushi Watanabe 0d1e856f7d codec/opus: support int16 interleaved format
Implement audio.Buffer and audio.ChannelMixer.
2020-06-08 20:43:12 -04:00
Atsushi Watanabe fee9ffa32c codec/vaapi: fix reference frame update
Previous reference frame update sequence was borrowed from
an example in libva-utils, however the quality of the output
was not good (block noised).
This commit disables alternate frame and updates golden frame only
on keyframe. It doesn't enable full referencing feature of VP8, but
ffmpeg vaapi encoder looks also not fully using golden frame and
alternate frame.
2020-04-29 07:14:53 -07:00
Atsushi Watanabe 8f9a29351f codec/vpx: add error resilient mode config 2020-04-27 20:44:33 -07:00
Atsushi Watanabe 62e3527a25 Use wave.Audio in codec/opus 2020-04-26 10:10:15 -07:00
Atsushi Watanabe 38deddc4f0 codec/vpx: add deadline parameter 2020-04-15 20:47:05 -04:00
Lukas Herman d58fe5c497 Fix wrong unit bitrate 2020-03-31 21:18:18 -04:00
Atsushi Watanabe 6f66c2866b codec/vaapi: fix VP8 reference surface usage
Fix not to use input surface as reference surface.
Fix flags of key-frame.
2020-03-31 09:59:42 -04:00
Atsushi Watanabe fa1fd13422 codec/vaapi: return error on unsupported environment
Make it buildable on unsupported environment.
Return error on runtime.
2020-03-28 22:12:07 -04:00
Lukas Herman 354f2710b5 Update from io.ReadCloser to codec.ReadCloser 2020-03-25 23:21:25 -04:00
Atsushi Watanabe 73cee07d71 Unify codec params type/func naming 2020-03-24 07:02:32 +09:00
Atsushi Watanabe 7bb7c9e927 codec/vaapi: calculate max bit-rate from BaseParam 2020-03-23 12:25:23 -04:00
Lukas Herman c9b90fb233 Redesign codec
Resolves https://github.com/pion/mediadevices/issues/114

* Remove codec registrar
* Completely redesign how codec is being discovered, tuned, and built
* Update examples
* Update unit tests
2020-03-21 07:45:10 -04:00