Skip to content

Commit 73be1da

Browse files
committed
makes copy of media frame and sends to delegates before forwarding frame to next in pipeline
1 parent 986ec17 commit 73be1da

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

windows/wrapper/impl_webrtc_VideoCapturer.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ namespace webrtc
450450
mrcVideoEffectDefinition.StreamType(MediaStreamType::VideoRecord);
451451
auto addEffectTask = Concurrency::create_task([this, &mrcVideoEffectDefinition]() {
452452
return media_capture_.get().AddVideoEffectAsync(mrcVideoEffectDefinition, MediaStreamType::VideoRecord).get();
453-
}).then([this](IMediaExtension const& videoExtension)
453+
}).then([this](IMediaExtension const& /* videoExtension */)
454454
{
455455
OutputDebugString(L"VideoEffect Added\n");
456456
video_effect_added_ = true;
@@ -1097,14 +1097,20 @@ namespace webrtc
10971097
!apply_rotation ? rotateFrame_ : kVideoRotation_0);
10981098
captureFrame.set_ntp_time_ms(captureTime);
10991099

1100+
forwardToDelegates(spMediaSample);
11001101
OnFrame(captureFrame, captureFrame.width(), captureFrame.height());
11011102

1103+
}
1104+
1105+
//-----------------------------------------------------------------------------
1106+
void VideoCapturer::forwardToDelegates(const winrt::com_ptr<IMFSample> &spMediaSample)
1107+
{
11021108
if (subscriptions_.size() < 1)
11031109
return;
11041110

11051111
winrt::com_ptr<IMFMediaBuffer> spSampleBuffer;
1106-
DWORD cbCurrentLength {};
1107-
DWORD cbMaxLength {};
1112+
DWORD cbCurrentLength{};
1113+
DWORD cbMaxLength{};
11081114

11091115
winrt::com_ptr<IMFSample> spSampleCopy;
11101116
winrt::com_ptr<IMFMediaBuffer> spSampleBufferCopy;
@@ -1144,7 +1150,7 @@ namespace webrtc
11441150
return;
11451151
}
11461152

1147-
wrapper::org::webRtc::MediaSamplePtr sample =
1153+
wrapper::org::webRtc::MediaSamplePtr sample =
11481154
wrapper::impl::org::webRtc::MediaSample::toWrapper(spSampleCopy);
11491155

11501156
subscriptions_.delegate()->onVideoFrameReceived(VideoCapturerPtr(), sample);

windows/wrapper/impl_webrtc_VideoCapturer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ namespace webrtc
9191
virtual void ApplyDisplayOrientation(
9292
winrt::Windows::Graphics::Display::DisplayOrientations orientation);
9393

94+
void forwardToDelegates(const winrt::com_ptr<IMFSample> &spMediaSample);
95+
9496
private:
9597
mutable zsLib::RecursiveLock lock_;
9698

0 commit comments

Comments
 (0)