Commit graph

13 commits

Author SHA1 Message Date
Guy Hershenbaum
f009e38fe0 Fix AudioSendStream reconfigure - stop processing during unconfigured state
When Reconfiguring there's a call to ResetSenderCongestionControlObjects followed by a later call to
RegisterSenderCongestionControlObjects which happen on the worker thread, while enqueuing packets is
happening on a different thread.
If packets are enqueued in between these calls we get a null dereference of the `rtp_packet_pacer_`
This change fixes it by pausing processing of incoming audio in the interim state

Bug: webrtc:358290775
Change-Id: I77cebfb131545ce2a6fdb26105dd999da3f7c443
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/359080
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Jakob Ivarsson‎ <jakobi@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42815}
2024-08-20 16:22:04 +00:00
Dan Tan
2406aaf475 Add accounting of actual audio bit usage
Part of a set of CL to allow video to borrow underused audio bitrate.

Bug: webrtc:35055527
Change-Id: Idb504cbbc5794c06b28bdc21b3d860c9da9df175
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/358202
Reviewed-by: Jakob Ivarsson‎ <jakobi@webrtc.org>
Commit-Queue: Dan Tan <dwtan@google.com>
Cr-Commit-Position: refs/heads/main@{#42733}
2024-08-06 18:04:46 +00:00
Danil Chapovalov
1030eaaffe Provide Environment to create an audio encoder in tests
Bug: webrtc:343086059
Change-Id: I73a48770ae67e529eb5065e957ea6420dea44975
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/354881
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Jakob Ivarsson‎ <jakobi@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42542}
2024-06-26 12:54:36 +00:00
Danil Chapovalov
c157f29216 Pass Environment into audio ChannelSend
To make it available for creating AudioEncoders in follow ups

Bug: webrtc:343086059
Change-Id: I24bb8f7e0494e392210cb1001ea0421030d2766b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/352601
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Jakob Ivarsson‎ <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42396}
2024-05-29 07:05:05 +00:00
Tony Herre
64437e8cc0 Calculate the audio level of audio packets before encoded transforms
Calculate the RMS audio level of audio packets being sent before
invoking an encoded frame transform, and pass them with the encode frame
object.

Before this, the audio level was calculated at send time by having rms_levels_ look at all audio samples encoded since the last send. This
is fine without a transform, as this is done synchronously after
encoding, but with an async transform which might take arbitrarily long,
we could end up marking older audio packets with newer audio levels, or
not at all.

This also makes things work correctly if external encoded frames are
injected from elsewhere to be sent, and exposes the AudioLevel on the
TransformableFrame interface.

Bug: chromium:337193823, webrtc:42226202
Change-Id: If55d2c1d30dc03408ca9fb0193d791db44428316
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/349263
Reviewed-by: Jakob Ivarsson‎ <jakobi@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tony Herre <herre@google.com>
Cr-Commit-Position: refs/heads/main@{#42193}
2024-04-29 15:14:25 +00:00
Tony Herre
9c6874607a Consolidate encoded transform mocks into api/test/
Includes removing the duplicate MockTransformableAudioFrame definition
in test/ in favour of the existing one in api/test/

Bug: webrtc:15802
Change-Id: Ib5f86b8b2095dd4e580cd9ff0038134f8a43cd93
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/336340
Auto-Submit: Tony Herre <herre@google.com>
Commit-Queue: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41622}
2024-01-26 12:46:34 +00:00
Danil Chapovalov
ee27f38be9 Use Environment in RtpTransportyControllerSend
RtpTransportControllerSend uses all 4 utilities of the environment and
thus cleaner to propagate them as single parameter instead of 4 separate

Bug: None
Change-Id: I38932c21a73ea41d4bdf2fa04bf3961a2adb25a2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/331821
Reviewed-by: Jakob Ivarsson‎ <jakobi@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41422}
2023-12-20 14:47:51 +00:00
Philipp Hancke
d2098933e1 Expose audio mimeType for insertable streams
Split from
  https://webrtc-review.googlesource.com/c/src/+/318283
to reduce CL size. Takes a different and (hopefully) simpler
approach.

BUG=webrtc:15579

Change-Id: I8517ffbeb0f0a76db80e3e367de727fb6976211d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/325023
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Tony Herre <herre@google.com>
Cr-Commit-Position: refs/heads/main@{#41073}
2023-11-03 09:49:12 +00:00
Tony Herre
36500ab634 Move RTPTimestamp offset handling out of encoded transform delegate
Keep the logic managing whether audio RTP timestamps have the random
start offset added or not inside ChannelSend, so that the
ChannelSendFrameTransformerDelegate doesn't need to worry about it.
Crucially, this means that frames moved between senders by encoded
transforms clients will always use the correct offset for the channel
where we actually get sent.

Also rename TS variables throughout both classes to be explicit over
whether the offset has been added or not.

Bug: chromium:1464847
Change-Id: I19955ec4c1cb834161b00dd74622725a070b713a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/317900
Commit-Queue: Tony Herre <herre@google.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40655}
2023-08-29 12:28:41 +00:00
Harald Alvestrand
d43af9172b Remove internal overrides using old SendRtp and SendRtcp interfaces.
This CL takes away all usages except for Android code.

Low-Coverage-Reason: Refactoring old code
Bug: webrtc:15410
Change-Id: I66bed6a4a2787b4177a82e599b48623ca67cd235
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/315940
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40554}
2023-08-15 13:20:21 +00:00
Danil Chapovalov
a2cf8ee854 Simplify handling rtcp messages in audio send channel
Delete VoERtcpObserver proxy:
pass BWE related message directly to transport controller
pass ReportBlock directly to ChannelSend, assuming there will be single report block per source ssrc

Bug: None
Change-Id: I8378326bff1dc3c2736960166fc782ee822a9c12
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/305224
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Jakob Ivarsson‎ <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40081}
2023-05-17 06:32:12 +00:00
Jakob Ivarsson
db208317eb Update RTP timestamp based on capture timestamp when audio send stream is resumed.
This removes the previous approach where we continued to update the timestamp when the capturer is running but the send stream is stopped in favor of a more general approach that also works when the capturer is paused.

Some assumptions for this change to be correct: input sample rate and frame size will be the same before/after the stream is paused.

Bug: webrtc:12397
Change-Id: I3b03741cd6d3285cbc9aee3893800729852e6cfa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291526
Commit-Queue: Jakob Ivarsson‎ <jakobi@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39213}
2023-01-27 15:46:32 +00:00
Jakob Ivarsson
dcb09ff218 Reset encoder when audio send stream is stopped.
This is to clear any remaining buffers and other state such as the next packet timestamp.

Bug: webrtc:12397
Change-Id: I2ef9a6f7254d82a69a2896ec8aa619ced2694fb8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291327
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Jakob Ivarsson‎ <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39206}
2023-01-26 15:20:02 +00:00