With tracks in different MTGs we risk of having thread races if we stop and start immediatelly. Previously, stoping and starting was happenign to the same MTG so this problem did not exist. This change wires a promise in the `MediaTrack::RemoveListener` method and perform the start when that step has been completed.
Differential Revision: https://phabricator.services.mozilla.com/D57947
--HG--
extra : moz-landing-system : lando
In `MediaPipelineTransmit::SetTrack()` the provided `MediaStreamTrack` connects to the existing send-track. This step crashes if the two tracks belong to different MTGs. With this change, when the two tracks belong to different MTGs, the existing send-track is stopped and deleted and a new send-track is created in the same MTG with the provided `MediaStreamTrack`.
Differential Revision: https://phabricator.services.mozilla.com/D57627
--HG--
extra : moz-landing-system : lando
- Convert to a StunAddrRequestState enum so there is now a pending state,
rather than just done/not done. This is to make sure we don't have
multiple stun addrs requests in flight at the same time.
- Reset the stun addrs in PeerConnectionMedia from PeerConnectionImpl when
PeerConnectionImpl::SetSignalingState_m detects ICE restart in an offer.
- GatherIfReady will now request new stun addrs if none are available.
Differential Revision: https://phabricator.services.mozilla.com/D55883
--HG--
extra : moz-landing-system : lando
We should only add a hostname to mSignaledAddresses if it is not obfuscated.
Prior to Bug 1567201 this was handled by an early exit in
MediaTransportHandlerSTS::AddIceCandidate if the address was obfuscated.
With the changes in Bug 1567201, that early exit went away and we're now adding
all addresses to mSignaledAddresses which breaks hiding prflx and srflx
addresses. Unfortunately, this is not something that easily unit testable.
Differential Revision: https://phabricator.services.mozilla.com/D57140
--HG--
extra : moz-landing-system : lando
Bug 1598923 - P1 - Remove use of description API and use format in SDP rust to C bindings;r?drno
Bug 1598923 - P2 - Add pref to select strictness of SDP parsing success;r?drno
Bug 1598923 - P3 - Update to WEBRTC-SDP 0.3.2;r?drno
Bug 1598923 - P4 - update to WEBRTC-SDP 0.3.3;r?mjf
Bug 1598923 - P5 - Adapt channel handling to WEBRTC-SDP changes;r?mjf
Differential Revision: https://phabricator.services.mozilla.com/D55211
--HG--
extra : moz-landing-system : lando
The STS thread dispatches SyncRunnables to main thread. There are two cases of
blocking affected here:
- SyncRunnables from main to STS:
Can cause a deadlock.
- PR_Sleep on the main thread:
Effectively sleeps STS too, if STS dispatches a SyncRunnable to main during
main's sleep.
This patch gets rid of both of these.
Depends on D57001
Differential Revision: https://phabricator.services.mozilla.com/D57003
--HG--
extra : moz-landing-system : lando
Before this patch, if a send audio MediaStreamTrack ended, we ended up not
sending anything over the network. If replaceTrack() at that point replaced the
ended track with a live one, we'd start sending data again, but the rtp stream
would continue from where the previous track ended.
Having a gap in audio like that would confuse a receiver's *video* jitter
buffer, because it's trying to sync to an audio track that just had a massive
amount of "jitter" (it can't tell the difference).
This patch fixes this by adding a track layer in MediaPipelineTransmit that
remains active for as long as the MediaPipeline is active. Thus if the send
audio MediaStreamTrack ends, we continue sending silence over the network, which
the receiver can understand. If later replaced, the receiver sees real audio
instead of silence and continues gracefully.
Differential Revision: https://phabricator.services.mozilla.com/D56619
--HG--
extra : moz-landing-system : lando
Before this patch, if a send audio MediaStreamTrack ended, we ended up not
sending anything over the network. If replaceTrack() at that point replaced the
ended track with a live one, we'd start sending data again, but the rtp stream
would continue from where the previous track ended.
Having a gap in audio like that would confuse a receiver's *video* jitter
buffer, because it's trying to sync to an audio track that just had a massive
amount of "jitter" (it can't tell the difference).
This patch fixes this by adding a track layer in MediaPipelineTransmit that
remains active for as long as the MediaPipeline is active. Thus if the send
audio MediaStreamTrack ends, we continue sending silence over the network, which
the receiver can understand. If later replaced, the receiver sees real audio
instead of silence and continues gracefully.
Differential Revision: https://phabricator.services.mozilla.com/D56619
--HG--
extra : moz-landing-system : lando
The inclusions were removed with the following very crude script and the
resulting breakage was fixed up by hand. The manual fixups did either
revert the changes done by the script, replace a generic header with a more
specific one or replace a header with a forward declaration.
find . -name "*.idl" | grep -v web-platform | grep -v third_party | while read path; do
interfaces=$(grep "^\(class\|interface\).*:.*" "$path" | cut -d' ' -f2)
if [ -n "$interfaces" ]; then
if [[ "$interfaces" == *$'\n'* ]]; then
regexp="\("
for i in $interfaces; do regexp="$regexp$i\|"; done
regexp="${regexp%%\\\|}\)"
else
regexp="$interfaces"
fi
interface=$(basename "$path")
rg -l "#include.*${interface%%.idl}.h" . | while read path2; do
hits=$(grep -v "#include.*${interface%%.idl}.h" "$path2" | grep -c "$regexp" )
if [ $hits -eq 0 ]; then
echo "Removing ${interface} from ${path2}"
grep -v "#include.*${interface%%.idl}.h" "$path2" > "$path2".tmp
mv -f "$path2".tmp "$path2"
fi
done
fi
done
Differential Revision: https://phabricator.services.mozilla.com/D55443
--HG--
extra : moz-landing-system : lando
Removes calls to the win32k API.
Replaces hardware and event timers with waitable timers.
Removes handling various task objects through the thread message queue.
Removes ProcessQueuedMessages, CancelTimers functions.
Adds event handle for stopping the TaskQueue thread.
Adds ReplyHandler class as an in between for TaskQueue objects to post tasks to each other without worrying if the other TaskQueue remains valid.
Adds rtc::CriticalSection's for timer_tasks_.
Removes ThreadState scoped class.
Differential Revision: https://phabricator.services.mozilla.com/D43480
--HG--
extra : moz-landing-system : lando
This moves the telemetry and preferences out into their own files and restores the parse result telemetery.
Differential Revision: https://phabricator.services.mozilla.com/D52749
--HG--
extra : moz-landing-system : lando
This moves the telemetry and preferences out into their own files and restores the parse result telemetery.
Differential Revision: https://phabricator.services.mozilla.com/D52749
--HG--
extra : moz-landing-system : lando
This moves the telemetry and preferences out into their own files and restores the parse result telemetery.
Differential Revision: https://phabricator.services.mozilla.com/D52749
--HG--
extra : moz-landing-system : lando
PhysicalSocketServer isn't currently used by Mozilla's WebRTC
integration, but just in case, let's make sure that this array index is
bounds-checked in actual use, not just in debug builds (which tend to
never see realistic test conditions).
Differential Revision: https://phabricator.services.mozilla.com/D52745
--HG--
extra : moz-landing-system : lando
This adds a whitelist of domains for which mDNS hostname obfuscation is
disabled. The implementation is an updated version of the old screensharing
whitelist code.
Differential Revision: https://phabricator.services.mozilla.com/D52012
--HG--
extra : moz-landing-system : lando
This adds a whitelist of domains for which mDNS hostname obfuscation is
disabled. The implementation is an updated version of the old screensharing
whitelist code.
Differential Revision: https://phabricator.services.mozilla.com/D52012
--HG--
extra : moz-landing-system : lando
The mDNS code makes use of the StunAddrsRequest which does not exist when
we are running with e10s disabled. If e10s is disabled, PeerConnectionMedia
will not be in the content process, and we can disable hostname obfuscation
in that case.
Differential Revision: https://phabricator.services.mozilla.com/D51986
--HG--
extra : moz-landing-system : lando
This swaps things around so that received tracks in peer connections have a
content principal instead of a null principal initially.
This puts an extra requirement on us to not output any frames under the content
principal after ALPN has been negotiated with requested privacy, but before this
private principal has been signaled to the MediaPipelines. The private principal
is signaled from the STS thread, via the main thread, whereas media is consumed
directly by MediaPipelines after being received on the STS thread.
This patch adds an extra signaling path directly from the STS thread that tells
MediaPipelines to make their PrincipalHandle private, and to ignore any data
until the private PrincipalHandle is set. It also moves the responsibility of
updating the principal of the received MediaStreamTracks from TransceiverImpl
to MediaPipeline, so it's all in the same path.
This lets all MediaStream and MediaStreamTrack APIs consume received tracks
directly after getting exposed to JS without errors. In case privacy is later
requested, consumers that have already been set up must handle this on the fly.
(They do, in specs and impls)
Differential Revision: https://phabricator.services.mozilla.com/D48947
--HG--
extra : moz-landing-system : lando
nsISerialEventTarget is more semantically accurate for these uses, as the
dispatched runnables cannot run in parallel. It also allows us to use
InvokeAsync in future patches, as that function only takes nsISerialEventTarget.
Differential Revision: https://phabricator.services.mozilla.com/D49262
--HG--
extra : moz-landing-system : lando
This patch fixes two things:
1) A potential threading issue in setting and reading the PrincipalHandle for
MediaPipelineReceiveVideo.
2) Plumbs the PrincipalHandle down to the receiving MediaPipelines right from
the start. It hasn't been necessary in the past as initially the principal
handed to a track's constructor is trusted, but it's good form and will help
clarify the situation for the next patch which switches the initial
principal from always-private to mostly-non-private. In most cases this
principal does no longer get updated after the track's been created, so it
helps to have a PrincipalHandle that matches the track's principal.
Differential Revision: https://phabricator.services.mozilla.com/D48946
--HG--
extra : moz-landing-system : lando
This swaps things around so that received tracks in peer connections have a
content principal instead of a null principal initially.
This puts an extra requirement on us to not output any frames under the content
principal after ALPN has been negotiated with requested privacy, but before this
private principal has been signaled to the MediaPipelines. The private principal
is signaled from the STS thread, via the main thread, whereas media is consumed
directly by MediaPipelines after being received on the STS thread.
This patch adds an extra signaling path directly from the STS thread that tells
MediaPipelines to make their PrincipalHandle private, and to ignore any data
until the private PrincipalHandle is set. It also moves the responsibility of
updating the principal of the received MediaStreamTracks from TransceiverImpl
to MediaPipeline, so it's all in the same path.
This lets all MediaStream and MediaStreamTrack APIs consume received tracks
directly after getting exposed to JS without errors. In case privacy is later
requested, consumers that have already been set up must handle this on the fly.
(They do, in specs and impls)
Differential Revision: https://phabricator.services.mozilla.com/D48947
--HG--
extra : moz-landing-system : lando
nsISerialEventTarget is more semantically accurate for these uses, as the
dispatched runnables cannot run in parallel. It also allows us to use
InvokeAsync in future patches, as that function only takes nsISerialEventTarget.
Differential Revision: https://phabricator.services.mozilla.com/D49262
--HG--
extra : moz-landing-system : lando
This patch fixes two things:
1) A potential threading issue in setting and reading the PrincipalHandle for
MediaPipelineReceiveVideo.
2) Plumbs the PrincipalHandle down to the receiving MediaPipelines right from
the start. It hasn't been necessary in the past as initially the principal
handed to a track's constructor is trusted, but it's good form and will help
clarify the situation for the next patch which switches the initial
principal from always-private to mostly-non-private. In most cases this
principal does no longer get updated after the track's been created, so it
helps to have a PrincipalHandle that matches the track's principal.
Differential Revision: https://phabricator.services.mozilla.com/D48946
--HG--
extra : moz-landing-system : lando
The number of channels is available in mAudioFrame in GetAudioFrame so
there is no reason to calculate it after the fact in MediaPipeline.
Differential Revision: https://phabricator.services.mozilla.com/D50934
--HG--
extra : moz-landing-system : lando
The use of select() was leading to crashes when the file descriptor value was
larger than FD_SETSIZE. Recent versions of glibc have checks in the FD_CLR(),
FD_SET() and FD_ISSET() macros that will abort() the program instead of doing
an out-of-bounds access. poll() doesn't have limitations on the file
descriptor values and provides behavior that is otherwise identical to
select() thus solving the problem.
Differential Revision: https://phabricator.services.mozilla.com/D50798
--HG--
extra : moz-landing-system : lando
This ICE candidate telemetry has not been used in a long time and in
addition requires special handling by the telemetry code. It is best
removed.
Differential Revision: https://phabricator.services.mozilla.com/D50656
--HG--
extra : moz-landing-system : lando
The code for handling backwards wraps left shifts num_wrap_ - 1. If
num_wrap_ is zero, this results in a left shift of a negative value which
is undefined behaviour. This modifies the code to avoid the shift at the cost
of an extra multiplication.
Differential Revision: https://phabricator.services.mozilla.com/D49609
--HG--
extra : moz-landing-system : lando
This adds checks for invalid and duplicated rtp extension ids to
JsepSessionImpl. Since the version of webrtc.org we're using does not support
two byte extension ids, ids must be between 1 and 14 inclusive. Duplicated
extension ids are also disallowed by RFC 8285. Passing an invalid extension id
into the webrtc.org code will trigger a release assertion and a browser crash.
Differential Revision: https://phabricator.services.mozilla.com/D48689
--HG--
extra : moz-landing-system : lando
These have already been fixed upstream. The upstream comment was: "Negative
overflow is permitted here, because this is auto-regressive filters, and the
state for each batch run is stored in the "negative" positions of the output
vector."
Differential Revision: https://phabricator.services.mozilla.com/D48884
--HG--
extra : moz-landing-system : lando
Left shifting a negative value results in undefined behaviour. It is safer to
multiply in this case.
Differential Revision: https://phabricator.services.mozilla.com/D48751
--HG--
extra : moz-landing-system : lando
Added playout-delay RTP header extension for video to JsepSessionImpl::SetupDefaultRtpExtensions.
This ensures that this extension will be preserved when generating an answer to an offer (by a sending peer) containing it.
Also updated JsepSessionTest to include a test verifying that the expected default audio and video extensions are set.
Differential Revision: https://phabricator.services.mozilla.com/D47689
--HG--
extra : moz-landing-system : lando
There is a window inside of SendPacket where the critical section is released
which means that other code could set paused_. This would lead to us hitting
the assertion at the top of SendPacket. Checking paused_ in the while loop
will avoid this. Upstream has fixed this problem in a similar way, but the
code has changed there enough that it doesn't make sense to try to bring in
their fix directly.
Differential Revision: https://phabricator.services.mozilla.com/D48540
--HG--
extra : moz-landing-system : lando
This is a partial cherrypick of https://webrtc.googlesource.com/src/+/f89110d67902e787f6745ad2b52f7f09fc808512.
The cropping changes in that revision are problematic on our version of webrtc.org and
result in distorted video, which looks as though there is a stride problem. This takes
the change to try to use PW_RENDERFULLCONTENT and to fall back to the current code if
that fails. This fixes capturing Chrome windows and allows Firefox to properly capture
its own window.
Using PW_RENDERFULLCONTENT can adversely affect performance. Using the
CroppingWindowCapturer can avoid using the WindowCapturer in some circumstances and so
result in better performance. Bug 1586071 tracks switching to the
CroppingWindowCapturer.
Differential Revision: https://phabricator.services.mozilla.com/D48108
--HG--
extra : moz-landing-system : lando
This change mainly removes the `mTracks` member from MediaStream and moves all
associated members up a level, so that a MediaStream in practice represents a
single track.
Classes will be renamed in a future patch to reflect this.
Other changes include:
The new `mEnded` member of MediaStream changes meaning to only become true when
all data in the stream has been processed. It stems from
StreamTracks::Track::mEnded which used to become true as soon as the last bit of
data had been added to a track, and there could still be data in the track that
would get processed in future iterations. We are moving towards not having any
future data in tracks, which is why this change is ok to make -- keeping the old
behavior will soon not make sense.
TrackUnionStream is changed to no longer take a list of streams as input and
forward the union of their tracks to itself. Instead it's limited to having one
track as input at a time.
The autofinishing functionality that TrackUnionStream had before has been
transformed into an autoending functionality to allow it to defer ending until
its been told that it's ok to end through the control API. This lets a single
TrackUnionStream span the lifetime of multiple inputs, which will be useful for
making DecodedStream spec compliant with HTMLMediaElement::CaptureStream(), and
for implementing the currently discussed MediaRecorder::ReplaceTrack(), to name
a few potential use cases.
AudioNodeStreams used to only have a track (and thus an AudioSegment) if the
EXTERNAL_OUTPUT flag was enabled on them. With all MediaStreams now representing
a track, AudioNodeStreams inherently have an AudioSegment as a member. It is
however only used with data if the EXTERNAL_OUTPUT flag is enabled.
Differential Revision: https://phabricator.services.mozilla.com/D45821
--HG--
extra : moz-landing-system : lando
This change mainly removes the `mTracks` member from MediaStream and moves all
associated members up a level, so that a MediaStream in practice represents a
single track.
Classes will be renamed in a future patch to reflect this.
Other changes include:
The new `mEnded` member of MediaStream changes meaning to only become true when
all data in the stream has been processed. It stems from
StreamTracks::Track::mEnded which used to become true as soon as the last bit of
data had been added to a track, and there could still be data in the track that
would get processed in future iterations. We are moving towards not having any
future data in tracks, which is why this change is ok to make -- keeping the old
behavior will soon not make sense.
TrackUnionStream is changed to no longer take a list of streams as input and
forward the union of their tracks to itself. Instead it's limited to having one
track as input at a time.
The autofinishing functionality that TrackUnionStream had before has been
transformed into an autoending functionality to allow it to defer ending until
its been told that it's ok to end through the control API. This lets a single
TrackUnionStream span the lifetime of multiple inputs, which will be useful for
making DecodedStream spec compliant with HTMLMediaElement::CaptureStream(), and
for implementing the currently discussed MediaRecorder::ReplaceTrack(), to name
a few potential use cases.
AudioNodeStreams used to only have a track (and thus an AudioSegment) if the
EXTERNAL_OUTPUT flag was enabled on them. With all MediaStreams now representing
a track, AudioNodeStreams inherently have an AudioSegment as a member. It is
however only used with data if the EXTERNAL_OUTPUT flag is enabled.
Differential Revision: https://phabricator.services.mozilla.com/D45821
--HG--
extra : moz-landing-system : lando
This adds a reference counted implementation of Telemetry::AutoTimer for use
in timing WebRTC calls. The telemetry is recorded when the reference count goes
from one to zero. This allows capturing the total call duration, rather than
the duration of individual PeerConnections. The timers are stored in a
HashTable, indexed by the Document URI, allowing for call durations to be
calculated individually for separate pages.
This reuses the existing WEBRTC_CALL_DURATION telemetry key. This means we
won't be able to compare telemetry from versions of Firefox with this change
to versions of Firefox without this change. The reason for making this change
is that the telemetry is not very useful in its current form, so I think it
makes sense to do this rather than adding a new key.
Differential Revision: https://phabricator.services.mozilla.com/D47800
--HG--
extra : moz-landing-system : lando
This limits the number of pending mDNS queries to 50, adds support for
retrying queries if they timeout, and support for reporting failure if a query
times out twice in a row.
Differential Revision: https://phabricator.services.mozilla.com/D46979
--HG--
extra : moz-landing-system : lando
I've reworked the includes in most of the files I've touched since I was adding
GMPLog.h:
- Reordered the includes to better match the Google C++ style.
- Removed includes that are already included from the associated header or
GMPLog.h. I.e. if Foo.cpp includes Foo.h, and Foo.cpp includes other headers
already included in Foo.h, these were removed.
Depends on D47194
Differential Revision: https://phabricator.services.mozilla.com/D47373
--HG--
extra : moz-landing-system : lando
This patch changes instances where the GMP MOZ_LOG is used to prefer using
macros from GMPLog.h:
- Files that don't need their own macros now just directly call
`GMP_LOG_<LEVEL>` as required.
- Files that use their own macros for formatting have had those macro
definitions changes so that the macros have unique names and are expressed in
terms of the macros from GMPLog.h.
I've also made a couple of drive by edits to logs so that they log more than a
couple of words and updated some strings where the incorrect class name was
being logged.
Differential Revision: https://phabricator.services.mozilla.com/D47194
--HG--
extra : moz-landing-system : lando
Video capture used to provide device change notifications for audio and video devices. From now on, CubebDeviceEnumerator will provide audio device change notifications thus video capture is updated to notify only changes of the video device. This is the windows part.
Differential Revision: https://phabricator.services.mozilla.com/D46274
--HG--
extra : moz-landing-system : lando
Video capture used to provide device change notifications for audio and video devices. From now on, CubebDeviceEnumerator will provide audio device change notifications thus video capture is updated to notify only changes of the video device. This is the OSX part.
Differential Revision: https://phabricator.services.mozilla.com/D46273
--HG--
extra : moz-landing-system : lando
Video capture used to provide device change notifications for audio and video devices. From now on, CubebDeviceEnumerator will provide audio device change notifications thus video capture is updated to notify only changes of the video device. This is the Linux part.
Differential Revision: https://phabricator.services.mozilla.com/D46272
--HG--
extra : moz-landing-system : lando
After Bug 1581193 devicechange notifications were triggered with any device change, not just video and audio devices. This patch limits down the notifications to only video and audio input devices change.
Differential Revision: https://phabricator.services.mozilla.com/D46147
--HG--
extra : moz-landing-system : lando
The Telemetry::AccumulateTimeDelta function reports in milliseconds but I had
assumed seconds when I added the hostname obfuscation ICE duration histogram.
This change adjusts the "high" value accordingly.
With the telemetry we've collected to date, 60% of the values are below 600
milliseconds, so I think that setting a high value of 30 seconds should be
sufficient even if there is a long tail. Since this does not change the data
being collected, no additional data-review is required, but it does require
renaming the key.
Differential Revision: https://phabricator.services.mozilla.com/D46045
--HG--
extra : moz-landing-system : lando
This restores the code for generating devicechange events that was
accidentally removed as part of updating the Windows video capture code
in Bug 1552755.
Differential Revision: https://phabricator.services.mozilla.com/D46033
--HG--
extra : moz-landing-system : lando
Bug 1568101/D40532 captures the input timestamp and uses it in the resolve
function. However, there could be multiple encoded frames returned (e.g.,
for Drain()), and all of them will get the same captured timestamp. Read
back the timestamp from encoded data makes sure every frame gets the right
value. Also convert it for EncodedImage::_timeStamp uses different unit.
Differential Revision: https://phabricator.services.mozilla.com/D45774
--HG--
extra : moz-landing-system : lando
Freeing the conduits when the transceiver is stopped releases all of the
associated webrtc.org objects which results in substantial memory savings.
On my system, with an opt+debug build and 200 stopped transceivers, I see
373.17 MB of memory use in the content process without this patch, and
158.93 MB of memory use with this patch applied.
Going further and calling Shutdown_m as part of Stop() reduces the memory
use to 157.98 MB, which seems like a marginal improvement at the cost of
a much larger risk of introducing bugs.
Differential Revision: https://phabricator.services.mozilla.com/D45845
--HG--
extra : moz-landing-system : lando
I just copied all the files from the upstream repository into the
rsdparsa directory
Differential Revision: https://phabricator.services.mozilla.com/D45717
--HG--
extra : moz-landing-system : lando
This adds a mObfuscateHostAddresses member and uses it to control whether or
not peer reflex candidates are redacted. It is only necessary to keep track of
signaled addresses to support redacting peer reflex candidates, so there is no
need to store them if host address obfuscation is disabled.
Differential Revision: https://phabricator.services.mozilla.com/D44531
--HG--
extra : moz-landing-system : lando
To accomodate this, MediaStreamTrackListener::NotifyEnded/Removed get an
additional aGraph argument. NotifyEnabledStateChanged is getting it too, for
completion.
Differential Revision: https://phabricator.services.mozilla.com/D43667
--HG--
extra : moz-landing-system : lando
Checking this assertion outside of the if statement can result in
a use-after-free in debug builds.
Differential Revision: https://phabricator.services.mozilla.com/D42152
--HG--
extra : moz-landing-system : lando
This only enables mDNS on OS X for now. Some versions of Windows lack mDNS
support, there are some oddities with resolving IPv6 addresses on Linux, and
Android has not yet been tested. All of these will be addressed in follow on
bugs.
Differential Revision: https://phabricator.services.mozilla.com/D38496
--HG--
extra : moz-landing-system : lando
Checking this assertion outside of the if statement can result in
a use-after-free in debug builds.
Differential Revision: https://phabricator.services.mozilla.com/D42152
--HG--
extra : moz-landing-system : lando
This only enables mDNS on OS X for now. Some versions of Windows lack mDNS
support, there are some oddities with resolving IPv6 addresses on Linux, and
Android has not yet been tested. All of these will be addressed in follow on
bugs.
Differential Revision: https://phabricator.services.mozilla.com/D38496
--HG--
extra : moz-landing-system : lando
In InitDecode it is possible for mDecoder to be null if the CreateDecoder call
fails, in which case an error code is returned. Release is called by
GenericDecoder::~VCMGenericDecoder regardless of whether InitDecode succeeds, so
we need to check if mDecoder is null in Release.
Differential Revision: https://phabricator.services.mozilla.com/D43469
--HG--
extra : moz-landing-system : lando
In OnIncomingFrame() we check if the capture has started by calling
CaptureStarted() which holds a lock. If StopCapture() is called on the
control thread after we check CaptureStarted() it is possible that
_captureCapability will be zeroed out prior to frame being delivered because
the lock has been released. This would result in an unknown video type in
CalcBufferSize() and trigger an assertion there. This creates a local copy of
_captureCapability with the lock held to ensure it is not zeroed out when the
frame is delivered.
Differential Revision: https://phabricator.services.mozilla.com/D42338
--HG--
extra : moz-landing-system : lando
This adds a field to about:webrtc which indicates whether an associated
candidate is behind a proxy or not.
Differential Revision: https://phabricator.services.mozilla.com/D39974
--HG--
extra : moz-landing-system : lando
As this class is not only used for creating decoder, also for encoder, it's more proper to rename it as `MediaDataCodec`.
Differential Revision: https://phabricator.services.mozilla.com/D41443
--HG--
rename : media/webrtc/signaling/src/media-conduit/MediaDataDecoderCodec.cpp => media/webrtc/signaling/src/media-conduit/MediaDataCodec.cpp
rename : media/webrtc/signaling/src/media-conduit/MediaDataDecoderCodec.h => media/webrtc/signaling/src/media-conduit/MediaDataCodec.h
extra : moz-landing-system : lando
Use `BitrateAdjuster` to calculate bitrate and prevent to set bitrate too often, because certain hardware encoders tend to consistently overshoot the bitrate that they are configured to encode at.
Differential Revision: https://phabricator.services.mozilla.com/D40533
--HG--
extra : moz-landing-system : lando
In order to encode video frame, we have to convert `webrtc::VideoFrame` to gecko's video data, and then send this YUV-based video data to the encoder.
The encoder won't return an encoded frame everytime when we call its `encode()`, so we have to wait until there are valid samples added to `mEncodedFrames`.
Then, convert the `MediaRawData` to `webrtc::EncodedImage` and provide an NAL entries list to indicate where the NALs are in the encoded bytes stream and how large they are. We would send those data back
to the consumer of the encoder via calling a callback function `OnEncodedImage()`.
Differential Revision: https://phabricator.services.mozilla.com/D40532
--HG--
extra : moz-landing-system : lando
`RefCountedWebrtcVideoEncoder` is a generic interface which supports refcounting, using that can ensure the encoder is always alive even if using it in an async task.
So now both `WebrtcGmpVideoEncoder` and `WebrtcMediaDataEncoder` would inherit from `RefCountedWebrtcVideoEncoder`.
We can use `WebrtcVideoEncoderProxy` to wrap them and return `WebrtcVideoEncoderProxy` for the use in the WebRTC pineline.
Differential Revision: https://phabricator.services.mozilla.com/D41855
--HG--
extra : moz-landing-system : lando
In this patch, we implement how to create a platform encoder, init an encoder and release it when we don't need it anymore.
In addition, as the encoder factory only supports h264 for now, so all configuration related to encoder would be h264 specific.
Differential Revision: https://phabricator.services.mozilla.com/D40531
--HG--
extra : moz-landing-system : lando
Implement a basic interface for `WebrtcMediaDataEncoder`, which will only be used on OSX for encoding h264 only.
Differential Revision: https://phabricator.services.mozilla.com/D40529
--HG--
extra : moz-landing-system : lando
The stack from crash report suggests that ChildImpl was deleted at the end of function GetOrCreateSocketActorForCurrentThread(). This only happens when SendInitBackground failed, so we have to close the IPC channel before ChildImpl getting destroyed.
Differential Revision: https://phabricator.services.mozilla.com/D40838
--HG--
extra : moz-landing-system : lando
Previously, the network.webRTCIPHandlingPolicy "disable_non_proxied_udp" only
enabled the use of WebRTC if a proxy was configured and the WebRTC service
supported TURN TCP.
This aims to match Chrome's behavior by forcing the use of a proxy if one is
configured, otherwise falling back to mode 3 (no host candidates and default
route only).
Also, remove some dead code left over from the old way of routing TURN
communications through an HTTP proxy.
Differential Revision: https://phabricator.services.mozilla.com/D37892
--HG--
extra : moz-landing-system : lando
This is inherently large, because modifying these bits of DOMMediaStream and
MediaStreamTrack affects all consumers and producers of all DOMMediaStreams and
MediaStreamTracks.
Things are generally much simpler now.
Producers of tracks now create a MediaStream in the graph, add it to a
MediaStreamTrackSource subclass that takes ownership of it, and add the source
to a MediaStreamTrack. Should the producer need a DOMMediaStream it is now much
simpler to create as the only thing needed is the current window. The stream is
a rather simple wrapper around an array of MediaStreamTracks.
HTMLMediaElement is still not as straight forward as other consumers since it
consumes the DOMMediaStream directly, as opposed to a set of tracks.
The new MediaStreamRenderer helper class helps bridge the gap between this fact
and the new track-based MediaStreamGraph interface, as it needs to juggle
registering multiple audio tracks for audio output. This hooks into existing
HTMLMediaElement logic and brings a welcome simplification to all the glue
previously needed there.
Differential Revision: https://phabricator.services.mozilla.com/D37934
--HG--
extra : moz-landing-system : lando
This ensures all clones of the original track also receives the new muted state.
Differential Revision: https://phabricator.services.mozilla.com/D37933
--HG--
extra : moz-landing-system : lando
They're infallible in practice and always `NS_OK`. (This stems from
`AddVarCacheNoAssignment()` always returning `NS_OK`.)
As a result, the commit removes lots of unnecessary checks.
Differential Revision: https://phabricator.services.mozilla.com/D39804
--HG--
extra : moz-landing-system : lando
When unknown, we rely on the picture height and assume that anything less than 720p is 601 and 709 otherwise. It's not perfect but it's the best we can do.
Differential Revision: https://phabricator.services.mozilla.com/D39275
--HG--
extra : moz-landing-system : lando
When unknown, we rely on the picture height and assume that anything less than 720p is 601 and 709 otherwise. It's not perfect but it's the best we can do.
Differential Revision: https://phabricator.services.mozilla.com/D39275
--HG--
extra : moz-landing-system : lando
When unknown, we rely on the picture height and assume that anything less than 720p is 601 and 709 otherwise. It's not perfect but it's the best we can do.
Differential Revision: https://phabricator.services.mozilla.com/D39275
--HG--
extra : moz-landing-system : lando
This requires replacing inclusions of it with inclusions of more specific prefs
files.
The exception is that StaticPrefsAll.h, which is equivalent to StaticPrefs.h,
and is used in `Codegen.py` because doing something smarter is tricky and
suitable for a follow-up. As a result, any change to StaticPrefList.yaml will
still trigger recompilation of all the generated DOM bindings files, but that's
still a big improvement over trigger recompilation of every file that uses
static prefs.
Most of the changes in this commit are very boring. The only changes that are
not boring are modules/libpref/*, Codegen.py, and ServoBindings.toml.
Differential Revision: https://phabricator.services.mozilla.com/D39138
--HG--
extra : moz-landing-system : lando
Fall back to using Google's DNS server to determine the associated local
addresses for web applications that are not loaded over the network. This
includes the loopback address, which is frequently used in the unit tests.
Provide a separate function for setting the target for the default local
address lookup.
Differential Revision: https://phabricator.services.mozilla.com/D37331
--HG--
extra : moz-landing-system : lando
draft-ietf-rtcweb-ip-handling specifies that the default route is the route
used to reach the origin rather than the one used to reach the internet, so
update the IP routing to reflect this. This addresses issues in which the
wrong IP address is used on machines with multiple network interfaces.
Differential Revision: https://phabricator.services.mozilla.com/D36831
--HG--
extra : moz-landing-system : lando
Fall back to using Google's DNS server to determine the associated local
addresses for web applications that are not loaded over the network. This
includes the loopback address, which is frequently used in the unit tests.
Provide a separate function for setting the target for the default local
address lookup.
Differential Revision: https://phabricator.services.mozilla.com/D37331
--HG--
extra : moz-landing-system : lando
draft-ietf-rtcweb-ip-handling specifies that the default route is the route
used to reach the origin rather than the one used to reach the internet, so
update the IP routing to reflect this. This addresses issues in which the
wrong IP address is used on machines with multiple network interfaces.
Differential Revision: https://phabricator.services.mozilla.com/D36831
--HG--
extra : moz-landing-system : lando
This makes the Rust parser's C API consistent with the changes made to sipcc
(i.e., the removal of unregistered transport types).
Differential Revision: https://phabricator.services.mozilla.com/D36203
--HG--
extra : moz-landing-system : lando
The array of transport names is defined in terms of the enum for SDP transport
types, so ensure that the two are consistent.
Differential Revision: https://phabricator.services.mozilla.com/D36043
--HG--
extra : moz-landing-system : lando
TCP/TLS/RTP/SAVP and TCP/TLS/RTP/SAVPF were never registered with IANA and were
not used by Firefox, so remove them. In the unit tests, replace them with the
registered TCP/DTLS/RTP/SAVPF string.
Differential Revision: https://phabricator.services.mozilla.com/D35836
--HG--
extra : moz-landing-system : lando
In bug 1552607/D36382, RemoteDataDecoder always increases session ID but
CodecProxy only performs flush IPC when neccessary. This will cause the
ID numbers out of sync and prevent remote decoder from receiving any
more input. By reading the session ID in dequeued input samples, the
numbers can always be in sync.
Differential Revision: https://phabricator.services.mozilla.com/D37123
--HG--
extra : moz-landing-system : lando
Because IPC call runs asynchronously in both remote decoder process and
content process, ProcessOutput() for buffers prior to Flush() could be
scheduled to run after the flush promise is resolved, and Codec.queueInput()
could be preempted and processes prior sample after flush.
To help check the validness of buffers, a session ID increased by flush
is added to both RemoteDataDecoder and remote codec service and will be
passed through IPC. If the passed ID doesn't agree with current session
ID, it means the buffer doesn't belong to current session and should be
discard.
Differential Revision: https://phabricator.services.mozilla.com/D36382
--HG--
extra : moz-landing-system : lando
Because IPC call runs asynchronously in both remote decoder process and
content process, ProcessOutput() for buffers prior to Flush() could be
scheduled to run after the flush promise is resolved, and Codec.queueInput()
could be preempted and processes prior sample after flush.
To help check the validness of buffers, a session ID increased by flush
is added to both RemoteDataDecoder and remote codec service and will be
passed through IPC. If the passed ID doesn't agree with current session
ID, it means the buffer doesn't belong to current session and should be
discard.
Differential Revision: https://phabricator.services.mozilla.com/D36382
--HG--
extra : moz-landing-system : lando
This also removes the following prefs, because they're unused:
- media.autoplay.allow-muted pref
- media.autoplay.blackList-override-default
Differential Revision: https://phabricator.services.mozilla.com/D36396
--HG--
extra : rebase_source : 0570540496302b3efedadf4d5115ee5422d5c279
In particular:
* trait objects without an explicit `dyn` are deprecated
* `...` range patterns are deprecated
I think these shouldn't really warn by default and should be clippy / opt-in
lints, but anyway, doesn't hurt.
Differential Revision: https://phabricator.services.mozilla.com/D35135
--HG--
extra : moz-landing-system : lando
This must have been broken while addressing review comments in Bug 1548841,
the first commit has it right and the last commit in the series breaks it.
Since we don't yet generate mDNS addresses in Firefox, the unit tests would not
catch this problem, and interoperability with other browsers would continue to
work due to peer reflex candidates.
We will have test coverage for this once we land generating our own mDNS
candidates. ICE will fail in the mochitests if we don't support resolving
mDNS addresses properly, which is how I discovered this bug.
Differential Revision: https://phabricator.services.mozilla.com/D34579
--HG--
extra : moz-landing-system : lando
This adds a scalar for the codecs used when receiving and sending video in
a WebRTC call.
Differential Revision: https://phabricator.services.mozilla.com/D33840
--HG--
extra : moz-landing-system : lando
In bug 1538508 we changed the MediaChangeMonitor to raise an error when we try
to create a decoder and we don't yet have the H.264 extra data, to maintain the
assumptions made by OpenH264/WebRTC. This however doesn't play nice with the
HLS demuxer, which won't always give you extra data after a seek.
So change the MediaChangeMonitor to by default assume that it should just drop
frames until it has the extra data it needs to create a decoder. We can flag
this mode off in the WebRTC MediaDataDecoder.
Differential Revision: https://phabricator.services.mozilla.com/D34079
--HG--
extra : moz-landing-system : lando
A few small changes are required to backport the updated windows capture code
to our version of webrtc.org. These are largely path changes, but
DetachFromThread has been renamed to Detach, and they seem to have a working
overload for ostream operator<< for VideoType that I have not been able to
track down. It is also necessary to add our local modification for pid_t back
to the GetDeviceName method, but it is not used for video capture anyways.
Depends on D33337
Differential Revision: https://phabricator.services.mozilla.com/D33338
--HG--
extra : moz-landing-system : lando
This was added in commit 74395345e8d2fecd504cb687eb79deee4ef394c3, but this
only cherry picks the ToHex part of that commit.
Depends on D33336
Differential Revision: https://phabricator.services.mozilla.com/D33337
--HG--
extra : moz-landing-system : lando
This updates just video_capture/windows to the tip of webrtc.org, from commit
8581877121f58435d683c2a39a73e72e5dcd558a.
This removes the locking which was leading to the deadlock in Bug 1552755. It
also removes the reliance upon the DirectShow example code which lead to our
local implementations of BaseFilter, BaseInputPin, BasePin, and MediaType.
These can now be removed.
Differential Revision: https://phabricator.services.mozilla.com/D33336
--HG--
extra : moz-landing-system : lando
This is a cherry pick of upstream commit c1187ab34bdf836bd33f7f050d525184eba4cd20.
Differential Revision: https://phabricator.services.mozilla.com/D32826
--HG--
extra : moz-landing-system : lando
This adds a mdns_addr field to nICEr ICE candidates to track the mDNS address
associated with a candidate, if any. This is used to hide the real address
when generating ICE stats. This potentially could be handled at the
MediaTransportHandler level, but we need to know if a candidate is mDNS to
prevent pairing it with relay candidates, which is part of the next commit.
This adds a unit tests to check that the mDNS addresses are handled properly.
As part of doing this, TestBogusCandidate was fixed. As written, it was never
parsing the bogus candidate because it was in the wrong ICE state.
Differential Revision: https://phabricator.services.mozilla.com/D30935
--HG--
extra : moz-landing-system : lando
This adds code to use the DNSService to resolve incoming mDNS candidates.
This could potentially be done within nICEr itself, but the delays
associated with resolving mDNS addresses make the timing there quite
awkward.
An internal DNSListener class is used to proxy requests back to the
MediaTransportHandler to avoid problems with multiple inheritance. Once
resolved, mDNS candidates are passed into nICEr as though they were
normal candidates. Avoiding leaking the actual address is done in the
second commit in this series.
Calling ActivateTransport can also potentially results in a call to
nr_ice_ctx_parse_candidate which would fail to handle mDNS candidates, but
we don't specify any candidates at that point.
Differential Revision: https://phabricator.services.mozilla.com/D29861
--HG--
extra : moz-landing-system : lando
This removes all references to application capture except from MediaSourceEnum.
That was left in place so as to not change the enumerated values used
for WEBRTC_GET_USER_MEDIA_TYPE telemetry.
Differential Revision: https://phabricator.services.mozilla.com/D28089
--HG--
extra : moz-landing-system : lando
This removes references to abseil which is not yet used by the version of
webrtc.org in tree. It also removes a duplicate definition of a kBytesPerPixel,
which is probably results from our use of unified builds.
With these changes and some hacking of moz.build files I was able to get the
pipewire support to compile but not link. I don't have an environment set up
to build and test this properly, so I didn't take it any further.
Depends on D27373
Differential Revision: https://phabricator.services.mozilla.com/D27374
--HG--
extra : moz-landing-system : lando
Since the only change for non-pipewire builds is moving some files, I
regenerated the x64_True_x64_linux.json file using gn, then generated
a patch file for the other configurations. This will hopefully remove
the need for non-Tier 1 platform maintainers to re-run gn for their
platforms.
Depends on D27369
Differential Revision: https://phabricator.services.mozilla.com/D27371
--HG--
extra : moz-landing-system : lando
This define is not set in the current gn generated json and moz.build files.
If I rerun gn, this define ends up being set, and the build will fail with
a variety of link time errors.
My guess is that enable_iterator_debugging was not set when I last ran gn for
x64 Linux, and that it was subsequently enabled without regenerating the gn
files and noticing that it causes problems.
Differential Revision: https://phabricator.services.mozilla.com/D27367
--HG--
extra : moz-landing-system : lando
moves where the VideoConduit related telemetry is recorded, so that non-standard stats can be removed from the stats report
Differential Revision: https://phabricator.services.mozilla.com/D22259
--HG--
extra : moz-landing-system : lando
roundTripTime can be zero once it has been non-zero this should help with intermitents in WPT and mochitests
Differential Revision: https://phabricator.services.mozilla.com/D25981
--HG--
extra : moz-landing-system : lando
OpenH264 1.8.1 occasionally generates a size of 0x01000000. This is a magic
value in the NAL which should be replaced with a valid size, but for some
reason this is not always happening. If we return early here, encoding will
continue to work as expected. This workaround can be removed once this issue is
addressed upstream, although that may require a new release of OpenH264.
Differential Revision: https://phabricator.services.mozilla.com/D25468
--HG--
extra : moz-landing-system : lando
We've hit a number of problems with handling of RGB24 video capture on
Windows. This adds a check that will ignore any RGB24 capture capabilities
when determining a best match if there are other capabilities available to
workaround the problems.
Differential Revision: https://phabricator.services.mozilla.com/D25449
--HG--
extra : moz-landing-system : lando