Commit Graph

25 Commits

Author SHA1 Message Date
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
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
Valentin Cocaud 3a04686875 Implements RequireKeyFrame for VPX codec (#334) 2021-06-12 11:28:59 -07: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 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 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 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 8f9a29351f codec/vpx: add error resilient mode config 2020-04-27 20:44:33 -07:00
Atsushi Watanabe 38deddc4f0 codec/vpx: add deadline parameter 2020-04-15 20:47:05 -04:00
Lukas Herman 354f2710b5 Update from io.ReadCloser to codec.ReadCloser 2020-03-25 23:21:25 -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
Atsushi Watanabe 15951b02b6 Support codec specific parameters 2020-03-07 16:51:17 -05:00
Atsushi Watanabe cd1be2ca80 Fix race condition in codecs
CGO based codecs caused segmentation fault due to the race condition
of Close() and Read().
2020-02-19 19:55:21 -08:00
Atsushi Watanabe 64fe0e1759 Fix non-standard C types
ulong and u_char are old name and are not available on musl libc.
2020-02-17 17:37:15 -08:00
Atsushi Watanabe 29d5a80f4f Reduce realloc in vpx codec 2020-02-17 14:55:49 +09:00
Atsushi Watanabe ad686605e1 Support size variable encoding of vpx 2020-02-17 14:51:24 +09:00
Atsushi Watanabe 030acd8262 Fix cgo pointer usage
Store Go pointers in C memory by C code and unref before return.
2020-02-15 19:06:25 -08:00
Atsushi Watanabe ad62a6a461 Fix vpx frame timestamp
Set frame timestamp by the system time to make encoder's bitrate
calcuation correct for variable framerate.
2020-02-13 21:40:45 -08:00
Atsushi Watanabe 00bcadc238 Add codec property
Add codec property, which stores general encoding parameters,
to MediaTrackConstraints.
2020-02-10 18:45:34 -08:00
Lukas Herman 152f15526b Add ToI420 converter
Moved I420 converter from vpx.go, converted video.Reader in openh264.go
and created ToI420 to convert a video.Reader to a new video.Reader that
will emit images in I420 format.
2020-02-09 08:02:15 -08:00
Atsushi Watanabe 303237d2ad Fix vpx codec error handling 2020-02-09 07:01:49 -08:00
Atsushi Watanabe 9453292b63 Convert pixel format on vpx encode
I444, I422 to I420
2020-02-08 22:30:21 -08:00
Atsushi Watanabe b0f5bfdc0d Implement vpx (VP8 and VP9) encoder
Requires libvpx.
2020-02-08 22:30:21 -08:00