Skip to content

Commit 458277e

Browse files
committed
Revert "Add NTP time ms to OnVideoFrameReceived."
This reverts commit 149f942.
1 parent 149f942 commit 458277e

File tree

11 files changed

+36
-63
lines changed

11 files changed

+36
-63
lines changed

examples/cpp-camera-stream-client/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ int main(int argc, char* argv[])
240240
cout << "\tid=" << client.id() << ", name=" << client.name() << endl;
241241
});
242242
client.setOnVideoFrameReceived(
243-
[](const Client& client, const cv::Mat& bgrImg, uint64_t timestampUs, uint64_t ntpTimeMs)
243+
[](const Client& client, const cv::Mat& bgrImg, uint64_t timestampUs)
244244
{
245245
// This callback is called from a WebRTC processing thread.
246246
cv::imshow(client.id(), bgrImg);

examples/cpp-video-stream-client/main.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ class SinAudioSource : public AudioSource
118118

119119
auto start = chrono::steady_clock::now();
120120
this_thread::sleep_for(SinAudioSourceFrameDuration - SinAudioSourceSleepBuffer);
121-
while ((chrono::steady_clock::now() - start) < SinAudioSourceFrameDuration)
122-
;
121+
while ((chrono::steady_clock::now() - start) < SinAudioSourceFrameDuration);
123122
}
124123
}
125124
};
@@ -233,7 +232,7 @@ int main(int argc, char* argv[])
233232
cout << "\tid=" << client.id() << ", name=" << client.name() << endl;
234233
});
235234
client.setOnVideoFrameReceived(
236-
[](const Client& client, const cv::Mat& bgrImg, uint64_t timestampUs, uint64_t ntpTimeMs)
235+
[](const Client& client, const cv::Mat& bgrImg, uint64_t timestampUs)
237236
{
238237
// This callback is called from a WebRTC processing thread.
239238
cout << "OnVideoFrameReceived:" << endl;

examples/python-stream-client/python_stream_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def on_remove_remote_stream(client):
6767
client.id, client.name, client.data))
6868

6969

70-
def on_video_frame_received(client, image, timestamp_us, ntp_time_us):
70+
def on_video_frame_received(client, image, timestampUs):
7171
# This callback is called from a WebRTC processing thread.
7272
cv2.imshow(client.id, image)
7373
cv2.waitKey(1)

opentera-webrtc-native-client/OpenteraWebrtcNativeClient/include/OpenteraWebrtcNativeClient/Handlers/StreamPeerConnectionHandler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace opentera
1212
{
13-
using VideoFrameReceivedCallback = std::function<void(const Client&, const cv::Mat&, uint64_t, uint64_t)>;
13+
using VideoFrameReceivedCallback = std::function<void(const Client&, const cv::Mat&, uint64_t)>;
1414
using EncodedVideoFrameReceivedCallback = std::function<void(
1515
const Client& client,
1616
const uint8_t* data,

opentera-webrtc-native-client/OpenteraWebrtcNativeClient/include/OpenteraWebrtcNativeClient/Sinks/VideoSink.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace opentera
1010
{
1111

12-
using VideoSinkCallback = std::function<void(const cv::Mat&, uint64_t, uint64_t)>;
12+
using VideoSinkCallback = std::function<void(const cv::Mat&, uint64_t)>;
1313

1414
/**
1515
* @brief Class that sinks frame from a webrtc stream
@@ -32,10 +32,7 @@ namespace opentera
3232
* @brief get frame requirements for this sink
3333
* @return frame requirements for this sink
3434
*/
35-
inline rtc::VideoSinkWants VideoSink::wants() const
36-
{
37-
return m_wants;
38-
}
35+
inline rtc::VideoSinkWants VideoSink::wants() const { return m_wants; }
3936

4037
}
4138

opentera-webrtc-native-client/OpenteraWebrtcNativeClient/include/OpenteraWebrtcNativeClient/StreamClient.h

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,12 @@ namespace opentera
9696
/**
9797
* @brief Mutes the local audio.
9898
*/
99-
inline void StreamClient::muteLocalAudio()
100-
{
101-
setLocalAudioMuted(true);
102-
}
99+
inline void StreamClient::muteLocalAudio() { setLocalAudioMuted(true); }
103100

104101
/**
105102
* @brief Unmutes the local audio.
106103
*/
107-
inline void StreamClient::unmuteLocalAudio()
108-
{
109-
setLocalAudioMuted(false);
110-
}
104+
inline void StreamClient::unmuteLocalAudio() { setLocalAudioMuted(false); }
111105

112106
/**
113107
* @brief Indicates if the remote audio is muted.
@@ -121,18 +115,12 @@ namespace opentera
121115
/**
122116
* @brief Mutes the remote audio.
123117
*/
124-
inline void StreamClient::muteRemoteAudio()
125-
{
126-
setRemoteAudioMuted(true);
127-
}
118+
inline void StreamClient::muteRemoteAudio() { setRemoteAudioMuted(true); }
128119

129120
/**
130121
* @brief Unmutes the remote audio.
131122
*/
132-
inline void StreamClient::unmuteRemoteAudio()
133-
{
134-
setRemoteAudioMuted(false);
135-
}
123+
inline void StreamClient::unmuteRemoteAudio() { setRemoteAudioMuted(false); }
136124

137125
/**
138126
* @brief Indicates if the local video is muted.
@@ -146,18 +134,12 @@ namespace opentera
146134
/**
147135
* @brief Mutes the local video.
148136
*/
149-
inline void StreamClient::muteLocalVideo()
150-
{
151-
setLocalVideoMuted(true);
152-
}
137+
inline void StreamClient::muteLocalVideo() { setLocalVideoMuted(true); }
153138

154139
/**
155140
* @brief Unmutes the local video.
156141
*/
157-
inline void StreamClient::unmuteLocalVideo()
158-
{
159-
setLocalVideoMuted(false);
160-
}
142+
inline void StreamClient::unmuteLocalVideo() { setLocalVideoMuted(false); }
161143

162144
/**
163145
* @brief Sets the callback that is called when a stream is added.
@@ -203,7 +185,6 @@ namespace opentera
203185
* - client: The client of the stream frame
204186
* - bgrImg: The BGR frame image
205187
* - timestampUs The timestamp in microseconds
206-
* - ntpTimeMs The ntp time in milliseconds
207188
* @endparblock
208189
*
209190
* @param callback The callback

opentera-webrtc-native-client/OpenteraWebrtcNativeClient/python/src/StreamClientPython.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ namespace py = pybind11;
1212

1313
void setOnVideoFrameReceived(
1414
StreamClient& self,
15-
const function<void(const Client&, const py::array_t<uint8_t>&, uint64_t, uint64_t)>& pythonCallback)
15+
const function<void(const Client&, const py::array_t<uint8_t>&, uint64_t)>& pythonCallback)
1616
{
17-
auto callback = [=](const Client& client, const cv::Mat& bgrImg, uint64_t timestampUs, uint64_t ntpTimeMs)
17+
auto callback = [=](const Client& client, const cv::Mat& bgrImg, uint64_t timestampUs)
1818
{
1919
size_t height = bgrImg.rows;
2020
size_t width = bgrImg.cols;
@@ -32,7 +32,7 @@ void setOnVideoFrameReceived(
3232

3333
py::gil_scoped_acquire acquire;
3434
py::array_t<uint8_t> numpyBgrImg(bufferInfo);
35-
pythonCallback(client, numpyBgrImg, timestampUs, ntpTimeMs);
35+
pythonCallback(client, numpyBgrImg, timestampUs);
3636
};
3737

3838
self.setOnVideoFrameReceived(callback);
@@ -315,7 +315,6 @@ void opentera::initStreamClientPython(pybind11::module& m)
315315
" - client: The client of the stream frame\n"
316316
" - bgr_img: The BGR frame image (numpy.array[uint8])\n"
317317
" - timestamp_us The timestamp in microseconds\n"
318-
" - ntp_time_ms The ntp time in milliseconds\n"
319318
"\n"
320319
":param callback: The callback")
321320
.def_property(

opentera-webrtc-native-client/OpenteraWebrtcNativeClient/python/test/stream_client_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ def on_add_remote_stream2(client):
7474
def on_remove_remote_stream(client):
7575
self.add_failure('on_remove_remote_stream')
7676

77-
def on_video_frame_received1(client, frame, timestamp_us, ntp_time_us):
77+
def on_video_frame_received1(client, frame, timestamp):
7878
self._mean_color_1 = np.mean(frame, axis=(0, 1))
7979
on_video_frame_awaiter1.done()
8080

81-
def on_video_frame_received2(client, frame, timestamp_us, ntp_time_us):
81+
def on_video_frame_received2(client, frame, timestamp):
8282
self._mean_color_2 = np.mean(frame, axis=(0, 1))
8383
on_video_frame_awaiter2.done()
8484

opentera-webrtc-native-client/OpenteraWebrtcNativeClient/src/Handlers/StreamPeerConnectionHandler.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ StreamPeerConnectionHandler::StreamPeerConnectionHandler(
4444
{
4545
if (onVideoFrameReceived)
4646
{
47-
m_videoSink = make_unique<VideoSink>([=](const cv::Mat& bgrImg, uint64_t timestampUs, uint64_t ntpTimeMs)
48-
{ onVideoFrameReceived(m_peerClient, bgrImg, timestampUs, ntpTimeMs); });
47+
m_videoSink = make_unique<VideoSink>([=](const cv::Mat& bgrImg, uint64_t timestampUs)
48+
{ onVideoFrameReceived(m_peerClient, bgrImg, timestampUs); });
4949
}
5050

5151
if (onEncodedVideoFrameReceived)
@@ -57,8 +57,7 @@ StreamPeerConnectionHandler::StreamPeerConnectionHandler(
5757
bool isKeyFrame,
5858
uint32_t width,
5959
uint32_t height,
60-
uint64_t timestampUs)
61-
{
60+
uint64_t timestampUs) {
6261
onEncodedVideoFrameReceived(
6362
m_peerClient,
6463
data,
@@ -78,8 +77,7 @@ StreamPeerConnectionHandler::StreamPeerConnectionHandler(
7877
int bitsPerSample,
7978
int sampleRate,
8079
size_t numberOfChannels,
81-
size_t numberOfFrames)
82-
{
80+
size_t numberOfFrames) {
8381
onAudioFrameReceived(
8482
m_peerClient,
8583
audioData,

opentera-webrtc-native-client/OpenteraWebrtcNativeClient/src/Sinks/VideoSink.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void VideoSink::OnFrame(const webrtc::VideoFrame& frame)
6161
switch (frame.rotation())
6262
{
6363
case webrtc::kVideoRotation_0:
64-
m_onFrameReceived(m_bgrImg, frame.timestamp_us(), frame.ntp_time_ms());
64+
m_onFrameReceived(m_bgrImg, frame.timestamp_us());
6565
return;
6666
case webrtc::kVideoRotation_90:
6767
cv::rotate(m_bgrImg, m_bgrRotatedImg, cv::ROTATE_90_CLOCKWISE);
@@ -73,5 +73,5 @@ void VideoSink::OnFrame(const webrtc::VideoFrame& frame)
7373
cv::rotate(m_bgrImg, m_bgrRotatedImg, cv::ROTATE_90_COUNTERCLOCKWISE);
7474
break;
7575
}
76-
m_onFrameReceived(m_bgrRotatedImg, frame.timestamp_us(), frame.ntp_time_ms());
76+
m_onFrameReceived(m_bgrRotatedImg, frame.timestamp_us());
7777
}

0 commit comments

Comments
 (0)