Commit Graph

31 Commits

Author SHA1 Message Date
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
Lukas Herman f95006bd5e Enhance driver Start error handling
Calling Start will now create a goroutine to run the underlying adapter
Start function concurrently. However, the driver Start function will
block until either it returns early with an error from adapter Start
function or after it receives the first data. This way, the caller
can make sure that the driver has started properly.
2020-02-06 22:44:29 -08:00
Lukas Herman 62aef6b8f3 Update codec to be dynamically registered 2020-01-05 22:12:44 -08:00
Lukas Herman 46b2c15bcf Rename Encoder/Decoder to VideoEncoder/VideoDecoder 2020-01-05 22:12:44 -08:00
Lukas Herman cf2a3436fe Merge github.com/pion/codec 2020-01-05 22:12:44 -08:00
Lukas Herman 5316a81aec Add some comments for better godoc 2019-12-28 09:39:31 -08:00
Lukas Herman 53244f8b27 Expose Tracker and Manager types for better godoc 2019-12-28 09:39:31 -08:00
Lukas Herman ec58fac1e7 Rename Spec to Setting 2019-12-28 09:39:31 -08:00
Lukas Herman 5679e3c0d7 Add SelectSettings algorithm and Codec to video constraints 2019-12-28 09:39:31 -08:00
Lukas Herman 9dbe3bfb9a Move reusable packages into pkg 2019-12-25 16:13:37 -08:00
Lukas Herman 417491ec95 Clean up driver's interfaces 2019-12-25 16:13:37 -08:00
Lukas Herman 709e56166f Completely rearchitect the overall project structure 2019-12-25 16:13:37 -08:00