diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /third_party/libwebrtc/audio/channel_receive_frame_transformer_delegate.cc | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/audio/channel_receive_frame_transformer_delegate.cc')
-rw-r--r-- | third_party/libwebrtc/audio/channel_receive_frame_transformer_delegate.cc | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/third_party/libwebrtc/audio/channel_receive_frame_transformer_delegate.cc b/third_party/libwebrtc/audio/channel_receive_frame_transformer_delegate.cc index 2d2893b8f7..8a7dda826e 100644 --- a/third_party/libwebrtc/audio/channel_receive_frame_transformer_delegate.cc +++ b/third_party/libwebrtc/audio/channel_receive_frame_transformer_delegate.cc @@ -10,6 +10,7 @@ #include "audio/channel_receive_frame_transformer_delegate.h" +#include <string> #include <utility> #include "rtc_base/buffer.h" @@ -22,10 +23,12 @@ class TransformableIncomingAudioFrame public: TransformableIncomingAudioFrame(rtc::ArrayView<const uint8_t> payload, const RTPHeader& header, - uint32_t ssrc) + uint32_t ssrc, + const std::string& codec_mime_type) : payload_(payload.data(), payload.size()), header_(header), - ssrc_(ssrc) {} + ssrc_(ssrc), + codec_mime_type_(codec_mime_type) {} ~TransformableIncomingAudioFrame() override = default; rtc::ArrayView<const uint8_t> GetData() const override { return payload_; } @@ -45,6 +48,7 @@ class TransformableIncomingAudioFrame } Direction GetDirection() const override { return Direction::kReceiver; } + std::string GetMimeType() const override { return codec_mime_type_; } const absl::optional<uint16_t> SequenceNumber() const override { return header_.sequenceNumber; } @@ -65,6 +69,7 @@ class TransformableIncomingAudioFrame rtc::Buffer payload_; RTPHeader header_; uint32_t ssrc_; + std::string codec_mime_type_; }; } // namespace @@ -92,10 +97,16 @@ void ChannelReceiveFrameTransformerDelegate::Reset() { void ChannelReceiveFrameTransformerDelegate::Transform( rtc::ArrayView<const uint8_t> packet, const RTPHeader& header, - uint32_t ssrc) { + uint32_t ssrc, + const std::string& codec_mime_type) { RTC_DCHECK_RUN_ON(&sequence_checker_); - frame_transformer_->Transform( - std::make_unique<TransformableIncomingAudioFrame>(packet, header, ssrc)); + if (short_circuit_) { + receive_frame_callback_(packet, header); + } else { + frame_transformer_->Transform( + std::make_unique<TransformableIncomingAudioFrame>(packet, header, ssrc, + codec_mime_type)); + } } void ChannelReceiveFrameTransformerDelegate::OnTransformedFrame( @@ -107,6 +118,14 @@ void ChannelReceiveFrameTransformerDelegate::OnTransformedFrame( }); } +void ChannelReceiveFrameTransformerDelegate::StartShortCircuiting() { + rtc::scoped_refptr<ChannelReceiveFrameTransformerDelegate> delegate(this); + channel_receive_thread_->PostTask([delegate = std::move(delegate)]() mutable { + RTC_DCHECK_RUN_ON(&delegate->sequence_checker_); + delegate->short_circuit_ = true; + }); +} + void ChannelReceiveFrameTransformerDelegate::ReceiveFrame( std::unique_ptr<TransformableFrameInterface> frame) const { RTC_DCHECK_RUN_ON(&sequence_checker_); @@ -138,4 +157,11 @@ void ChannelReceiveFrameTransformerDelegate::ReceiveFrame( // originally from this receiver. receive_frame_callback_(frame->GetData(), header); } + +rtc::scoped_refptr<FrameTransformerInterface> +ChannelReceiveFrameTransformerDelegate::FrameTransformer() { + RTC_DCHECK_RUN_ON(&sequence_checker_); + return frame_transformer_; +} + } // namespace webrtc |