Skip to content

Commit 92b2e08

Browse files
nisseCommit bot
authored andcommitted
Revert of Delete cricket::VideoFrame::GetTimeStamp. (patchset #2 id:150001 of https://codereview.webrtc.org/2310043002/ )
Reason for revert: Broke Chrome fyi bots. See, e.g., https://build.chromium.org/p/chromium.webrtc.fyi/builders/Win%20Builder/builds/6730/steps/compile/logs/stdio Use of GetTimeStamp must be eliminated in Chrome before relanding. Original issue's description: > Reland of Delete cricket::VideoFrame::GetTimeStamp. (patchset #1 id:1 of https://codereview.webrtc.org/2306953002/ ) > > Reason for revert: > Will reland after downstream projects are updated. > > Original issue's description: > > Revert of Delete cricket::VideoFrame::GetTimeStamp. (patchset #1 id:1 of https://codereview.webrtc.org/2305623002/ ) > > > > Reason for revert: > > Broke downstream project. > > > > Original issue's description: > > > Delete cricket::VideoFrame::GetTimeStamp. > > > > > > [email protected] # Trivial change to VideoRendererAdapter > > > BUG=webrtc:5682 > > > > > > Committed: https://crrev.com/fd6c99e43137d01fa6c120f7160f7c2999d1d8a3 > > > Cr-Commit-Position: refs/heads/master@{#14037} > > > > [email protected] > > # Skipping CQ checks because original CL landed less than 1 days ago. > > NOPRESUBMIT=true > > NOTREECHECKS=true > > NOTRY=true > > BUG=webrtc:5682 > > > > Committed: https://crrev.com/bca69e87de5df290f728833a4b3d8af3ae5d88e6 > > Cr-Commit-Position: refs/heads/master@{#14038} > > [email protected] > # Not skipping CQ checks because original CL landed more than 1 days ago. > BUG=webrtc:5682 > > Committed: https://crrev.com/fa1ba19c5c7c57c8d16fae1a5da51877770fd53e > Cr-Commit-Position: refs/heads/master@{#14089} [email protected] # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:5682 Review-Url: https://codereview.webrtc.org/2315703002 Cr-Commit-Position: refs/heads/master@{#14090}
1 parent fa1ba19 commit 92b2e08

File tree

6 files changed

+25
-18
lines changed

6 files changed

+25
-18
lines changed

webrtc/media/base/fakevideorenderer.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class FakeVideoRenderer : public rtc::VideoSinkInterface<cricket::VideoFrame> {
2626
width_(0),
2727
height_(0),
2828
rotation_(webrtc::kVideoRotation_0),
29-
timestamp_us_(0),
29+
timestamp_(0),
3030
num_rendered_frames_(0),
3131
black_frame_(false) {}
3232

@@ -43,7 +43,7 @@ class FakeVideoRenderer : public rtc::VideoSinkInterface<cricket::VideoFrame> {
4343
width_ = frame.width();
4444
height_ = frame.height();
4545
rotation_ = frame.rotation();
46-
timestamp_us_ = frame.timestamp_us();
46+
timestamp_ = frame.GetTimeStamp();
4747
SignalRenderFrame(&frame);
4848
}
4949

@@ -61,9 +61,9 @@ class FakeVideoRenderer : public rtc::VideoSinkInterface<cricket::VideoFrame> {
6161
return rotation_;
6262
}
6363

64-
int64_t timestamp_us() const {
64+
int64_t timestamp() const {
6565
rtc::CritScope cs(&crit_);
66-
return timestamp_us_;
66+
return timestamp_;
6767
}
6868
int num_rendered_frames() const {
6969
rtc::CritScope cs(&crit_);
@@ -133,7 +133,7 @@ class FakeVideoRenderer : public rtc::VideoSinkInterface<cricket::VideoFrame> {
133133
int width_;
134134
int height_;
135135
webrtc::VideoRotation rotation_;
136-
int64_t timestamp_us_;
136+
int64_t timestamp_;
137137
int num_rendered_frames_;
138138
bool black_frame_;
139139
rtc::CriticalSection crit_;

webrtc/media/base/videobroadcaster_unittest.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ TEST(VideoBroadcasterTest, SinkWantsBlackFrames) {
143143
10 /* timestamp_us */, 0 /* frame_id */);
144144
broadcaster.OnFrame(frame1);
145145
EXPECT_TRUE(sink1.black_frame());
146-
EXPECT_EQ(10, sink1.timestamp_us());
146+
EXPECT_EQ(10000, sink1.timestamp());
147147
EXPECT_FALSE(sink2.black_frame());
148-
EXPECT_EQ(10, sink2.timestamp_us());
148+
EXPECT_EQ(10000, sink2.timestamp());
149149

150150
// Switch the sink wants.
151151
wants1.black_frames = false;
@@ -157,7 +157,7 @@ TEST(VideoBroadcasterTest, SinkWantsBlackFrames) {
157157
30 /* timestamp_us */, 0 /* frame_id */);
158158
broadcaster.OnFrame(frame2);
159159
EXPECT_FALSE(sink1.black_frame());
160-
EXPECT_EQ(30, sink1.timestamp_us());
160+
EXPECT_EQ(30000, sink1.timestamp());
161161
EXPECT_TRUE(sink2.black_frame());
162-
EXPECT_EQ(30, sink2.timestamp_us());
162+
EXPECT_EQ(30000, sink2.timestamp());
163163
}

webrtc/media/base/videoframe.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ class VideoFrame {
4545
virtual int64_t timestamp_us() const = 0;
4646
virtual void set_timestamp_us(int64_t time_us) = 0;
4747

48+
// Deprecated methods, for backwards compatibility.
49+
// TODO(nisse): Delete when usage in Chrome and other applications
50+
// have been replaced.
51+
virtual int64_t GetTimeStamp() const {
52+
return rtc::kNumNanosecsPerMicrosec * timestamp_us();
53+
}
54+
4855
// Indicates the rotation angle in degrees.
4956
virtual webrtc::VideoRotation rotation() const = 0;
5057

webrtc/media/base/videoframe_unittest.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -453,16 +453,15 @@ class VideoFrameTest : public testing::Test {
453453
static bool IsEqual(const cricket::VideoFrame& frame,
454454
int width,
455455
int height,
456-
int64_t timestamp_us,
456+
int64_t time_stamp,
457457
const uint8_t* y,
458458
uint32_t ypitch,
459459
const uint8_t* u,
460460
uint32_t upitch,
461461
const uint8_t* v,
462462
uint32_t vpitch,
463463
int max_error) {
464-
return IsSize(frame, width, height) &&
465-
frame.timestamp_us() == timestamp_us &&
464+
return IsSize(frame, width, height) && frame.GetTimeStamp() == time_stamp &&
466465
IsPlaneEqual("y", frame.video_frame_buffer()->DataY(),
467466
frame.video_frame_buffer()->StrideY(), y, ypitch,
468467
static_cast<uint32_t>(width),
@@ -482,7 +481,7 @@ class VideoFrameTest : public testing::Test {
482481
int max_error) {
483482
return IsEqual(frame1,
484483
frame2.width(), frame2.height(),
485-
frame2.timestamp_us(),
484+
frame2.GetTimeStamp(),
486485
frame2.video_frame_buffer()->DataY(),
487486
frame2.video_frame_buffer()->StrideY(),
488487
frame2.video_frame_buffer()->DataU(),
@@ -500,7 +499,7 @@ class VideoFrameTest : public testing::Test {
500499
IsEqual(frame1,
501500
frame2.width() - hcrop * 2,
502501
frame2.height() - vcrop * 2,
503-
frame2.timestamp_us(),
502+
frame2.GetTimeStamp(),
504503
frame2.video_frame_buffer()->DataY()
505504
+ vcrop * frame2.video_frame_buffer()->StrideY()
506505
+ hcrop,

webrtc/media/engine/webrtcvideoframe_unittest.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,15 @@ TEST_F(WebRtcVideoFrameTest, TextureInitialValues) {
186186
webrtc::NativeHandleBuffer* buffer =
187187
new rtc::RefCountedObject<webrtc::test::FakeNativeHandleBuffer>(
188188
dummy_handle, 640, 480);
189-
190-
WebRtcVideoFrame frame(buffer, webrtc::kVideoRotation_0, 20);
189+
// Timestamp is converted from ns to us, so last three digits are lost.
190+
WebRtcVideoFrame frame(buffer, 20000, webrtc::kVideoRotation_0);
191191
EXPECT_EQ(dummy_handle, frame.video_frame_buffer()->native_handle());
192192
EXPECT_EQ(640, frame.width());
193193
EXPECT_EQ(480, frame.height());
194+
EXPECT_EQ(20000, frame.GetTimeStamp());
194195
EXPECT_EQ(20, frame.timestamp_us());
195196
frame.set_timestamp_us(40);
197+
EXPECT_EQ(40000, frame.GetTimeStamp());
196198
EXPECT_EQ(40, frame.timestamp_us());
197199
}
198200

webrtc/sdk/objc/Framework/Classes/RTCVideoRendererAdapter.mm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ void OnFrame(const cricket::VideoFrame& nativeVideoFrame) override {
3030
RTCVideoFrame* videoFrame = [[RTCVideoFrame alloc]
3131
initWithVideoBuffer:nativeVideoFrame.video_frame_buffer()
3232
rotation:nativeVideoFrame.rotation()
33-
timeStampNs:nativeVideoFrame.timestamp_us() *
34-
rtc::kNumNanosecsPerMicrosec];
33+
timeStampNs:nativeVideoFrame.GetTimeStamp()];
3534
CGSize current_size = (videoFrame.rotation % 180 == 0)
3635
? CGSizeMake(videoFrame.width, videoFrame.height)
3736
: CGSizeMake(videoFrame.height, videoFrame.width);

0 commit comments

Comments
 (0)