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_unittest.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_unittest.cc')
-rw-r--r-- | third_party/libwebrtc/audio/channel_receive_frame_transformer_delegate_unittest.cc | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/third_party/libwebrtc/audio/channel_receive_frame_transformer_delegate_unittest.cc b/third_party/libwebrtc/audio/channel_receive_frame_transformer_delegate_unittest.cc index 38ceb6d96d..8bdf217d5a 100644 --- a/third_party/libwebrtc/audio/channel_receive_frame_transformer_delegate_unittest.cc +++ b/third_party/libwebrtc/audio/channel_receive_frame_transformer_delegate_unittest.cc @@ -93,7 +93,7 @@ TEST(ChannelReceiveFrameTransformerDelegateTest, [&callback](std::unique_ptr<TransformableFrameInterface> frame) { callback->OnTransformedFrame(std::move(frame)); }); - delegate->Transform(packet, header, 1111 /*ssrc*/); + delegate->Transform(packet, header, /*ssrc=*/1111, /*mimeType=*/"audio/opus"); rtc::ThreadManager::ProcessAllMessageQueuesForTesting(); } @@ -126,7 +126,7 @@ TEST(ChannelReceiveFrameTransformerDelegateTest, static_cast<TransformableAudioFrameInterface*>(frame.get()); callback->OnTransformedFrame(CloneSenderAudioFrame(transformed_frame)); }); - delegate->Transform(packet, header, 1111 /*ssrc*/); + delegate->Transform(packet, header, /*ssrc=*/1111, /*mimeType=*/"audio/opus"); rtc::ThreadManager::ProcessAllMessageQueuesForTesting(); } @@ -150,5 +150,29 @@ TEST(ChannelReceiveFrameTransformerDelegateTest, rtc::ThreadManager::ProcessAllMessageQueuesForTesting(); } +TEST(ChannelReceiveFrameTransformerDelegateTest, + ShortCircuitingSkipsTransform) { + rtc::AutoThread main_thread; + rtc::scoped_refptr<MockFrameTransformer> mock_frame_transformer = + rtc::make_ref_counted<testing::NiceMock<MockFrameTransformer>>(); + MockChannelReceive mock_channel; + rtc::scoped_refptr<ChannelReceiveFrameTransformerDelegate> delegate = + rtc::make_ref_counted<ChannelReceiveFrameTransformerDelegate>( + mock_channel.callback(), mock_frame_transformer, + rtc::Thread::Current()); + const uint8_t data[] = {1, 2, 3, 4}; + rtc::ArrayView<const uint8_t> packet(data, sizeof(data)); + RTPHeader header; + + delegate->StartShortCircuiting(); + rtc::ThreadManager::ProcessAllMessageQueuesForTesting(); + + // Will not call the actual transformer. + EXPECT_CALL(*mock_frame_transformer, Transform).Times(0); + // Will pass the frame straight to the channel. + EXPECT_CALL(mock_channel, ReceiveFrame); + delegate->Transform(packet, header, /*ssrc=*/1111, /*mimeType=*/"audio/opus"); +} + } // namespace } // namespace webrtc |