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.
> > >
> > > TBR=tkchin@webrtc.org  # Trivial change to VideoRendererAdapter
> > > BUG=webrtc:5682
> > >
> > > Committed: https://crrev.com/fd6c99e43137d01fa6c120f7160f7c2999d1d8a3
> > > Cr-Commit-Position: refs/heads/master@{#14037}
> >
> > TBR=perkj@webrtc.org
> > # 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}
>
> TBR=perkj@webrtc.org
> # 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}

TBR=perkj@webrtc.org
# 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}
This commit is contained in:
nisse 2016-09-06 05:13:42 -07:00 committed by Commit bot
parent fa1ba19c5c
commit 92b2e0852f
6 changed files with 25 additions and 18 deletions

View File

@ -26,7 +26,7 @@ class FakeVideoRenderer : public rtc::VideoSinkInterface<cricket::VideoFrame> {
width_(0),
height_(0),
rotation_(webrtc::kVideoRotation_0),
timestamp_us_(0),
timestamp_(0),
num_rendered_frames_(0),
black_frame_(false) {}
@ -43,7 +43,7 @@ class FakeVideoRenderer : public rtc::VideoSinkInterface<cricket::VideoFrame> {
width_ = frame.width();
height_ = frame.height();
rotation_ = frame.rotation();
timestamp_us_ = frame.timestamp_us();
timestamp_ = frame.GetTimeStamp();
SignalRenderFrame(&frame);
}
@ -61,9 +61,9 @@ class FakeVideoRenderer : public rtc::VideoSinkInterface<cricket::VideoFrame> {
return rotation_;
}
int64_t timestamp_us() const {
int64_t timestamp() const {
rtc::CritScope cs(&crit_);
return timestamp_us_;
return timestamp_;
}
int num_rendered_frames() const {
rtc::CritScope cs(&crit_);
@ -133,7 +133,7 @@ class FakeVideoRenderer : public rtc::VideoSinkInterface<cricket::VideoFrame> {
int width_;
int height_;
webrtc::VideoRotation rotation_;
int64_t timestamp_us_;
int64_t timestamp_;
int num_rendered_frames_;
bool black_frame_;
rtc::CriticalSection crit_;

View File

@ -143,9 +143,9 @@ TEST(VideoBroadcasterTest, SinkWantsBlackFrames) {
10 /* timestamp_us */, 0 /* frame_id */);
broadcaster.OnFrame(frame1);
EXPECT_TRUE(sink1.black_frame());
EXPECT_EQ(10, sink1.timestamp_us());
EXPECT_EQ(10000, sink1.timestamp());
EXPECT_FALSE(sink2.black_frame());
EXPECT_EQ(10, sink2.timestamp_us());
EXPECT_EQ(10000, sink2.timestamp());
// Switch the sink wants.
wants1.black_frames = false;
@ -157,7 +157,7 @@ TEST(VideoBroadcasterTest, SinkWantsBlackFrames) {
30 /* timestamp_us */, 0 /* frame_id */);
broadcaster.OnFrame(frame2);
EXPECT_FALSE(sink1.black_frame());
EXPECT_EQ(30, sink1.timestamp_us());
EXPECT_EQ(30000, sink1.timestamp());
EXPECT_TRUE(sink2.black_frame());
EXPECT_EQ(30, sink2.timestamp_us());
EXPECT_EQ(30000, sink2.timestamp());
}

View File

@ -45,6 +45,13 @@ class VideoFrame {
virtual int64_t timestamp_us() const = 0;
virtual void set_timestamp_us(int64_t time_us) = 0;
// Deprecated methods, for backwards compatibility.
// TODO(nisse): Delete when usage in Chrome and other applications
// have been replaced.
virtual int64_t GetTimeStamp() const {
return rtc::kNumNanosecsPerMicrosec * timestamp_us();
}
// Indicates the rotation angle in degrees.
virtual webrtc::VideoRotation rotation() const = 0;

View File

@ -453,7 +453,7 @@ class VideoFrameTest : public testing::Test {
static bool IsEqual(const cricket::VideoFrame& frame,
int width,
int height,
int64_t timestamp_us,
int64_t time_stamp,
const uint8_t* y,
uint32_t ypitch,
const uint8_t* u,
@ -461,8 +461,7 @@ class VideoFrameTest : public testing::Test {
const uint8_t* v,
uint32_t vpitch,
int max_error) {
return IsSize(frame, width, height) &&
frame.timestamp_us() == timestamp_us &&
return IsSize(frame, width, height) && frame.GetTimeStamp() == time_stamp &&
IsPlaneEqual("y", frame.video_frame_buffer()->DataY(),
frame.video_frame_buffer()->StrideY(), y, ypitch,
static_cast<uint32_t>(width),
@ -482,7 +481,7 @@ class VideoFrameTest : public testing::Test {
int max_error) {
return IsEqual(frame1,
frame2.width(), frame2.height(),
frame2.timestamp_us(),
frame2.GetTimeStamp(),
frame2.video_frame_buffer()->DataY(),
frame2.video_frame_buffer()->StrideY(),
frame2.video_frame_buffer()->DataU(),
@ -500,7 +499,7 @@ class VideoFrameTest : public testing::Test {
IsEqual(frame1,
frame2.width() - hcrop * 2,
frame2.height() - vcrop * 2,
frame2.timestamp_us(),
frame2.GetTimeStamp(),
frame2.video_frame_buffer()->DataY()
+ vcrop * frame2.video_frame_buffer()->StrideY()
+ hcrop,

View File

@ -186,13 +186,15 @@ TEST_F(WebRtcVideoFrameTest, TextureInitialValues) {
webrtc::NativeHandleBuffer* buffer =
new rtc::RefCountedObject<webrtc::test::FakeNativeHandleBuffer>(
dummy_handle, 640, 480);
WebRtcVideoFrame frame(buffer, webrtc::kVideoRotation_0, 20);
// Timestamp is converted from ns to us, so last three digits are lost.
WebRtcVideoFrame frame(buffer, 20000, webrtc::kVideoRotation_0);
EXPECT_EQ(dummy_handle, frame.video_frame_buffer()->native_handle());
EXPECT_EQ(640, frame.width());
EXPECT_EQ(480, frame.height());
EXPECT_EQ(20000, frame.GetTimeStamp());
EXPECT_EQ(20, frame.timestamp_us());
frame.set_timestamp_us(40);
EXPECT_EQ(40000, frame.GetTimeStamp());
EXPECT_EQ(40, frame.timestamp_us());
}

View File

@ -30,8 +30,7 @@ class VideoRendererAdapter
RTCVideoFrame* videoFrame = [[RTCVideoFrame alloc]
initWithVideoBuffer:nativeVideoFrame.video_frame_buffer()
rotation:nativeVideoFrame.rotation()
timeStampNs:nativeVideoFrame.timestamp_us() *
rtc::kNumNanosecsPerMicrosec];
timeStampNs:nativeVideoFrame.GetTimeStamp()];
CGSize current_size = (videoFrame.rotation % 180 == 0)
? CGSizeMake(videoFrame.width, videoFrame.height)
: CGSizeMake(videoFrame.height, videoFrame.width);