Commit Graph

71 Commits

Author SHA1 Message Date
Jackie Li a45a5e50cd fix track.unbind panic (#634)
Fix #633

Here the signalCh could have been closed by another goroutine, we should
use returned signalCh from `track.removeActivePeerConnection()` to close
the channel.

Actually, I don't know why we need to close the signalCh, we're using it
to send over the doneCh, why ever close it?
2025-06-13 13:31:00 +08:00
Jingyang Kang 9d5e9cb3ea Add EncoderController() codec.EncoderController in Track interface. (#614)
* Add EncoderController() codec.EncoderController in Track interface.

* Update test, add EncoderController in mockMediaStreamTrack.
2025-03-10 07:25:14 -07:00
Jingyang Kang 9a47a07eba Add EncoderController method to VideoTrack and AudioTrack. (#612)
* Add GetEncoderController method for VideoTrack and AudioTrack.

* Change the naming, remove unecessary private getter func.
2025-03-09 22:35:55 -07:00
Jingyang Kang 4027590fcb Migrate to pion/webrtc/v4 (#592) 2024-12-10 14:12:02 +09:00
Kyle 5da0ebf443 Fix deadlock in track.Bind() (#466)
Occurs when read errors happen from a
driver source during a call to track.Bind()
2023-01-23 10:00:20 +09:00
Denys Malykhin 73a158d097 Fix for preventing close of stopRead nil channel (#458)
* Fix for preventing close of stopRead nil channel

* Prevent use of stopRead before assignment
2022-12-19 14:05:19 -05:00
Valentin Cocaud 8ad810e61e fix PLI and FIR handling, wrongly triggering track.OnEnded (#420) 2022-08-16 11:13:33 +02:00
Sean DuBois 601f27c014 Fix crash when capturing AudioTracks
Resolves #426
2022-08-04 22:14:44 -04:00
Valentin Cocaud 2af325d1a5 Fix closing a camera not closing the associated track (#414) 2022-07-27 14:15:17 +02:00
Valentin Cocaud d038133783 Allow to enable frame copy on a video track (#405) 2022-07-25 16:56:03 +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
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