Commit graph

14 commits

Author SHA1 Message Date
Florent Castelli
8037fc6ffa Migrate absl::optional to std::optional
Bug: webrtc:342905193
No-Try: True
Change-Id: Icc968be43b8830038ea9a1f5f604307220457807
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/361021
Auto-Submit: Florent Castelli <orphis@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42911}
2024-09-02 12:16:47 +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
Danil Chapovalov
0f1b9a9589 Replace rtc::TaskQueue* with TaskQueueBase* in audio channel send frame transformer
To remove unneeded dependency on rtc::TaskQueue wrapper

Bug: webrtc:14169
Change-Id: Ib43da5c2a942a8278761db6a99a1632e72ee34fb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/334920
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Auto-Submit: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Jakob Ivarsson‎ <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41555}
2024-01-18 09:39:55 +00:00
Tony Herre
5f3ac43551 Ensure cloning and then sending audio encoded frames propagates CSRCs
Bug: chromium:1508337
Change-Id: I9f28fc0958d28bc97f9378a46fbec3e45148736f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/330260
Reviewed-by: Guido Urdaneta <guidou@webrtc.org>
Commit-Queue: Tony Herre <herre@google.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41337}
2023-12-07 15:09:01 +00:00
Tony Herre
6e956053b7 Support shortcircuiting encoded transforms
Add a StartShortCircuiting() callback to allow clients which have
configured Encoded Transforms when creating a PeerConnection to have
all frames skip the transform. This offers a zero cost path for streams
which don't need transforms.

This is preferable to uninstalling/not installing the transform to allow
implementing the behaviour in
https://w3c.github.io/webrtc-encoded-transform/#stream-creation -
giving web apps a chance to configure transforms within a short window
(before the next JS event loop run, so usually sub-millisecond) after stream creation, without any untransformed frames passing.

Usage in Chromium: crrev.com/c/5040731

Bug: chromium:1502781
Change-Id: I803477db1df51e80bdedf6c84d2d3695b088de83
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/327601
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tony Herre <herre@google.com>
Cr-Commit-Position: refs/heads/main@{#41184}
2023-11-17 13:03:27 +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
Tony Herre
097a4decc2 Make all encodedaudioframes inherit from TransformableAudioFrameI'face
Make outgoing encoded audio frames inherit from the same Audio interface
that incoming frames inherit from, to align them and make it possible to
eg clone frames regardless of their direction.

Also begin removing GetHeader() from the Audio interface, replacing it
with getters for the specific values we actually need to propagate in
the API: sequence number and CSRCs. This makes it much easier to treat
incoming and outgoing frames the same, even if they don't have full
RtpHeaders prepared at the point of the transform.

Bug: chromium:1453226
Change-Id: Ib5b39b30dea8a378b3b26efb1589dfd64741d201
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/308141
Commit-Queue: Tony Herre <herre@google.com>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Palak Agarwal <agpalak@google.com>
Cr-Commit-Position: refs/heads/main@{#40309}
2023-06-19 18:54:47 +00:00
Tove Petersson
1e2d951762 Add a clone method to the audio frame transformer API.
This will clone an encoded audio frame into a sender frame.

Bug: webrtc:14949
Change-Id: Ie62d9f5ec457541b335bde8f2f6e9b6d24704cf6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/294560
Commit-Queue: Tove Petersson <tovep@google.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39480}
2023-03-06 08:22:25 +00:00
Artem Titov
b0ea637ec2 Use backticks not vertical bars to denote variables in comments for /audio
Bug: webrtc:12338
Change-Id: Ief89269aa39d0cb6749a1c6cc995ce8830ca327f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226942
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34564}
2021-07-27 15:36:40 +00:00
Artem Titov
d15a575ec3 Use SequenceChecker from public API
Bug: webrtc:12419
Change-Id: I00cca16a0ec70246156ba00b97aa7ae5ccbf5364
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/205323
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33220}
2021-02-10 15:04:55 +00:00
Markus Handell
6287280d64 Migrate audio/ to use webrtc::Mutex
Bug: webrtc:11567
Change-Id: Ic6a753f09aafb508690f4b8dadd4c99433fcfeb6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176741
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31635}
2020-07-06 14:21:38 +00:00
Philipp Hancke
b9d468573a insertable streams: include rtp_timestamp offset for audio
includes the (random) rtp start offset in the timestamp passed to the frame transformer callback

Bug: chromium:1069278
Change-Id: I7d10130404d93df7cee3b8f87a0b780801a51415
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173329
Commit-Queue: Marina Ciocea <marinaciocea@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Reviewed-by: Marina Ciocea <marinaciocea@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31067}
2020-04-14 14:54:07 +00:00
Marina Ciocea
65674d83e1 Transform encoded frames in ChannelSend.
This change is part of the implementation of the Insertable Streams Web
API: https://github.com/alvestrand/webrtc-media-streams/blob/master/explainer.md

Design doc for WebRTC library changes:
http://doc/1eiLkjNUkRy2FssCPLUp6eH08BZuXXoHfbbBP1ZN7EVk

Bug: webrtc:11380
Change-Id: I75444283ddb7f8db742687b497bf532c6dda47be
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/171871
Commit-Queue: Marina Ciocea <marinaciocea@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30952}
2020-03-31 21:59:26 +00:00