Commit Graph

61 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
Sean DuBois e316b30964 Add RID to Track and baseTrack (#376)
This was added in pion/webrtc@f644649
2022-01-15 20:15:56 -08:00
renovate[bot] 86cb9f8ce8 Update module github.com/pion/webrtc/v3 to v3.1.5 (#345)
* Update module github.com/pion/webrtc/v3 to v3.1.5
* Cast MTU type

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Atsushi Watanabe <atsushi.w@ieee.org>
2021-11-01 09:20:03 +09:00
Will Forcey b263026d52 Fixed Comment Error 2021-07-22 08:55:34 +09:00
Valentin Cocaud 5f95b84719 Fix dead lock when closing peer connection with running tracks (#337) 2021-06-12 11:28:19 -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
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 97046bc6ec Add NewEncodedIOReader (#263)
Changes:
  * [BREAKING CHANGE] NewEncodedReader is renamed to NewEncodedIOReader
  * NewEncodedReader now returns a non-standard buffer reader to give
  more meta data such as sample count
2020-12-14 22:07:57 -05:00
Lukas Herman 3ea7120130 Remove some hardcoded microphone metadata
Changes:
  * Use malgo.DeviceInfo to get the microphone metadata
  * Move static buffering to the driver layer
2020-11-21 14:07:32 -08:00
Lukas Herman 716da16e4a Add NewEncodedReeader API
Changes:
  * Add NewEncodedReeader method to Track interface
  * Add video archival example
2020-11-09 23:17:48 -08:00
Lukas Herman 1550a68003 Fix incorrect audio sampler 2020-11-09 22:24:42 -08:00
Lukas Herman 7cbda134b0 Add NewRTPReader to Track interface 2020-11-02 22:28:01 -08:00
Lukas Herman 79dcb4f1af Add video and audio RTP readers 2020-11-02 22:12:43 -08:00
Lukas Herman 5db4007e73 Enable non-webrtc sampler 2020-11-01 15:31:36 -08:00
Lukas Herman 77ebcecac6 Add codec selector by string names 2020-11-01 15:14:08 -08:00
Lukas Herman b089610c27 Fix incorrect audio latency 2020-11-01 00:32:20 -07:00
Lukas Herman e6c98a844f Remove unused fmt 2020-10-30 10:01:07 -07:00
Lukas Herman 2a70c031b8 Remove unwanted logging 2020-10-30 09:04:51 -07:00
Lukas Herman 765318feb6 Fix webrtc example 2020-10-30 01:19:03 -07:00
Lukas Herman 2f5e4ee914 New mediadevices design
Changelog:
  * Better support for non-webrtc use cases
  * Enable multiple readers
  * Enhance codec selectors
  * Update APIs to reflect on the new v3 webrtc design
  * Cleaner APIs
2020-10-30 00:33:55 -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 238f190e71 Use MediaDeviceInfo instead of webrtc.RTPCodecType
Changes:
  * Add unit tests for mediastream
  * Remove webrtc.RTPCodecType dependency in mediastream
  * Add Kind to Tracker interface
2020-10-11 01:29:59 -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 ecff5e63a5 prop: support ranged/exact/oneof constraints 2020-05-24 10:26:16 +09:00
Lukas Herman 0683f973b8 Fix formatting 2020-04-19 00:17:06 -04:00
Lukas Herman 8127ce3be6 Refractor track to be more DRY
Resolves https://github.com/pion/mediadevices/issues/141

 * Remove newVideoTrack and newAudioTrack
 * Add a generic encoderBuilder struct
 * Add newVideoEncoderBuilders and newAudioEncoderBuilders helpers
 * Update sampler to be functional and add support for audio sampler
 * Reduce boilerplates by using closure
2020-04-18 23:51:09 -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 2bac44aa8a Close drivers on stream initialization failure
In GetUserMedia and GetDisplayMedia, driver was left opened if
initialization failure. Since Trackers are not returned on error,
there was no way to close them.
This commit closes Trackers on GetUserMedia/GetDisplayMedia failure.
2020-02-19 20:21:21 -08:00
Atsushi Watanabe 32731904f8 Call OnEnded even if errored before registering
OnEnded handler was not called if something errored before
registering the handler. Store error and call handler immediately
on handler registration.
2020-02-19 19:45:49 -08:00
Atsushi Watanabe 6b32f6eac2 Fix LocalTrack interfacing 2020-02-14 07:06:29 -08:00
Lukas Herman 1635910909 Protect mmap allocated memory by copying it into Go heap
- Move closing synchronization to the driver level
- Create a buffer for copying the memory allocated by mmap to Go heap
2020-02-13 19:35:52 -08:00
Atsushi Watanabe c8bba53148 Stop video track safely
- Treat camera read timeout as error and return detailed errors.
- Return io.EOF on Read after Close.
- Wait finishing video read loop to avoid memory violation
  as the video frames might be alloced by C or on shared memory.
2020-02-13 19:35:52 -08:00
Atsushi Watanabe bca254261d Allow to use user defined Track
Add WithTrackGenerator option to specify TrackGenerator.
This allows user to replace Track by user defined one that
has WriteSample() and Codec() interface.
2020-02-12 22:24:32 -08:00
Lukas Herman ed1352b6ff Fix Track's ID and Label are swapped
Resolves https://github.com/pion/mediadevices/issues/32
2020-02-12 22:22:36 -08:00
Lukas Herman c6d0f3ec02 Add custom video/audio transforms
Resolves https://github.com/pion/mediadevices/issues/31
2020-02-12 08:17:57 -08:00
Lukas Herman ec310e566b Move Codec from MediaTrackConstraints to prop.Codec 2020-02-10 20:07:41 -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
Atsushi Watanabe 1e868fc3e3 Add OnEnded handler
In Web API, MediaStreamTrack.ended event is fired and
MediaStreamTrack.onended handler is called on device error.
This commit adds same way to handle errors.
2020-02-10 17:43:31 -08:00
Atsushi Watanabe 2fd3907305 Add MediaDevicesFromCodecs
Add a constructor directly from lists of codecs.
It makes MediaDevices capable for non-WebRTC purposes
as same as the Web API.
2020-02-09 07:12:04 -08:00
Lukas Herman aece2b94c6 Refractor, unify some APIs to be more DRY 2020-02-06 22:44:29 -08:00
Lukas Herman 2640f6c1f4 Move all settings to video/audio under io 2020-02-06 22:44:29 -08:00
Lukas Herman 2d9bfcda4d Remove Kind in favor of type assertion 2020-02-06 22:44:29 -08:00
Lukas Herman dcf4524223 Fix audio stream 2020-02-06 22:44:29 -08:00
Lukas Herman e1365d8811 Convert video APIs to use video.Reader 2020-02-06 22:44:29 -08:00
Lukas Herman 9466cf89fc Update audio APIs to use audio.Reader instead 2020-02-06 22:44:29 -08:00
Lukas Herman 2465f227d7 Refractor track.go
* sampler now also sends the data to track
* Add a base track to reduce redundancy
2020-02-06 22:44:29 -08:00
Lukas Herman 61c0b53c55 Add initial audio support 2020-02-06 22:44:29 -08:00