From 7755e2064b5b8add2ff0c9d0b5d3fb34ee1726d1 Mon Sep 17 00:00:00 2001 From: perkj Date: Thu, 19 Nov 2015 12:02:21 -0800 Subject: [PATCH] Chrome has now been updated. CapturedFrame Removed deprecated elapsed_time. Changed rotation to be webrtc::VideoRotation. WebRTCVideoFrame Removed deprecated InitToBlack Removed deprecated constructors. Review URL: https://codereview.webrtc.org/1461053002 Cr-Commit-Position: refs/heads/master@{#10718} --- talk/app/webrtc/androidvideocapturer.cc | 8 +++++--- talk/media/base/videocapturer.cc | 7 +------ talk/media/base/videocapturer.h | 10 +--------- talk/media/base/videoframefactory.cc | 4 ++-- talk/media/webrtc/webrtcvideoframe.cc | 19 +------------------ talk/media/webrtc/webrtcvideoframe.h | 9 --------- 6 files changed, 10 insertions(+), 47 deletions(-) diff --git a/talk/app/webrtc/androidvideocapturer.cc b/talk/app/webrtc/androidvideocapturer.cc index afcfb5bb7c..d850ab8add 100644 --- a/talk/app/webrtc/androidvideocapturer.cc +++ b/talk/app/webrtc/androidvideocapturer.cc @@ -57,11 +57,13 @@ class AndroidVideoCapturer::FrameFactory : public cricket::VideoFrameFactory { const rtc::scoped_refptr& buffer, int rotation, int64_t time_stamp_in_ns) { + RTC_DCHECK(rotation == 0 || rotation == 90 || rotation == 180 || + rotation == 270); buffer_ = buffer; captured_frame_.width = buffer->width(); captured_frame_.height = buffer->height(); captured_frame_.time_stamp = time_stamp_in_ns; - captured_frame_.rotation = rotation; + captured_frame_.rotation = static_cast(rotation); } void ClearCapturedFrame() { @@ -85,7 +87,7 @@ class AndroidVideoCapturer::FrameFactory : public cricket::VideoFrameFactory { rtc::scoped_ptr frame(new cricket::WebRtcVideoFrame( ShallowCenterCrop(buffer_, dst_width, dst_height), - captured_frame->time_stamp, captured_frame->GetRotation())); + captured_frame->time_stamp, captured_frame->rotation)); // Caller takes ownership. // TODO(magjed): Change CreateAliasedFrame() to return a rtc::scoped_ptr. return apply_rotation_ ? frame->GetCopyWithRotationApplied()->Copy() @@ -101,7 +103,7 @@ class AndroidVideoCapturer::FrameFactory : public cricket::VideoFrameFactory { if (buffer_->native_handle() != nullptr) { // TODO(perkj): Implement CreateAliasedFrame properly for textures. rtc::scoped_ptr frame(new cricket::WebRtcVideoFrame( - buffer_, input_frame->time_stamp, input_frame->GetRotation())); + buffer_, input_frame->time_stamp, input_frame->rotation)); return frame.release(); } return VideoFrameFactory::CreateAliasedFrame(input_frame, diff --git a/talk/media/base/videocapturer.cc b/talk/media/base/videocapturer.cc index ca4b9069f1..5d9a7e022a 100644 --- a/talk/media/base/videocapturer.cc +++ b/talk/media/base/videocapturer.cc @@ -82,7 +82,7 @@ CapturedFrame::CapturedFrame() pixel_height(0), time_stamp(0), data_size(0), - rotation(0), + rotation(webrtc::kVideoRotation_0), data(NULL) {} // TODO(fbarchard): Remove this function once lmimediaengine stops using it. @@ -94,11 +94,6 @@ bool CapturedFrame::GetDataSize(uint32_t* size) const { return true; } -webrtc::VideoRotation CapturedFrame::GetRotation() const { - ASSERT(rotation == 0 || rotation == 90 || rotation == 180 || rotation == 270); - return static_cast(rotation); -} - ///////////////////////////////////////////////////////////////////// // Implementation of class VideoCapturer ///////////////////////////////////////////////////////////////////// diff --git a/talk/media/base/videocapturer.h b/talk/media/base/videocapturer.h index 0a11ed09c1..387a4b95c1 100644 --- a/talk/media/base/videocapturer.h +++ b/talk/media/base/videocapturer.h @@ -78,10 +78,6 @@ struct CapturedFrame { // fourcc. Return true if succeeded. bool GetDataSize(uint32_t* size) const; - // TODO(guoweis): Change the type of |rotation| from int to - // webrtc::VideoRotation once chromium gets the code. - webrtc::VideoRotation GetRotation() const; - // The width and height of the captured frame could be different from those // of VideoFormat. Once the first frame is captured, the width, height, // fourcc, pixel_width, and pixel_height should keep the same over frames. @@ -90,15 +86,11 @@ struct CapturedFrame { uint32_t fourcc; // compression uint32_t pixel_width; // width of a pixel, default is 1 uint32_t pixel_height; // height of a pixel, default is 1 - // TODO(magjed): |elapsed_time| is deprecated - remove once not used anymore. - int64_t elapsed_time; int64_t time_stamp; // timestamp of when the frame was captured, in unix // time with nanosecond units. uint32_t data_size; // number of bytes of the frame data - // TODO(guoweis): This can't be converted to VideoRotation yet as it's - // used by chrome now. - int rotation; // rotation in degrees of the frame (0, 90, 180, 270) + webrtc::VideoRotation rotation; // rotation in degrees of the frame. void* data; // pointer to the frame data. This object allocates the // memory or points to an existing memory. diff --git a/talk/media/base/videoframefactory.cc b/talk/media/base/videoframefactory.cc index dfd97c6faa..fb81096c31 100644 --- a/talk/media/base/videoframefactory.cc +++ b/talk/media/base/videoframefactory.cc @@ -51,8 +51,8 @@ VideoFrame* VideoFrameFactory::CreateAliasedFrame( // If the frame is rotated, we need to switch the width and height. if (apply_rotation_ && - (input_frame->GetRotation() == webrtc::kVideoRotation_90 || - input_frame->GetRotation() == webrtc::kVideoRotation_270)) { + (input_frame->rotation == webrtc::kVideoRotation_90 || + input_frame->rotation == webrtc::kVideoRotation_270)) { std::swap(output_width, output_height); } diff --git a/talk/media/webrtc/webrtcvideoframe.cc b/talk/media/webrtc/webrtcvideoframe.cc index 7da7e3b7fb..fcc991c753 100644 --- a/talk/media/webrtc/webrtcvideoframe.cc +++ b/talk/media/webrtc/webrtcvideoframe.cc @@ -56,17 +56,6 @@ WebRtcVideoFrame::WebRtcVideoFrame( rotation_(rotation) { } -WebRtcVideoFrame::WebRtcVideoFrame( - const rtc::scoped_refptr& buffer, - int64_t elapsed_time_ns, - int64_t time_stamp_ns) - : video_frame_buffer_(buffer), - pixel_width_(1), - pixel_height_(1), - time_stamp_ns_(time_stamp_ns), - rotation_(webrtc::kVideoRotation_0) { -} - WebRtcVideoFrame::~WebRtcVideoFrame() {} bool WebRtcVideoFrame::Init(uint32_t format, @@ -90,13 +79,7 @@ bool WebRtcVideoFrame::Init(const CapturedFrame* frame, int dw, int dh, return Reset(frame->fourcc, frame->width, frame->height, dw, dh, static_cast(frame->data), frame->data_size, frame->pixel_width, frame->pixel_height, frame->time_stamp, - frame->GetRotation(), apply_rotation); -} - -bool WebRtcVideoFrame::InitToBlack(int w, int h, size_t pixel_width, - size_t pixel_height, int64_t, - int64_t time_stamp_ns) { - return InitToBlack(w, h, pixel_width, pixel_height, time_stamp_ns); + frame->rotation, apply_rotation); } bool WebRtcVideoFrame::InitToBlack(int w, int h, size_t pixel_width, diff --git a/talk/media/webrtc/webrtcvideoframe.h b/talk/media/webrtc/webrtcvideoframe.h index 906e6e7053..827cf28821 100644 --- a/talk/media/webrtc/webrtcvideoframe.h +++ b/talk/media/webrtc/webrtcvideoframe.h @@ -46,11 +46,6 @@ class WebRtcVideoFrame : public VideoFrame { int64_t time_stamp_ns, webrtc::VideoRotation rotation); - // TODO(guoweis): Remove this when chrome code base is updated. - WebRtcVideoFrame(const rtc::scoped_refptr& buffer, - int64_t elapsed_time_ns, - int64_t time_stamp_ns); - ~WebRtcVideoFrame(); // Creates a frame from a raw sample with FourCC "format" and size "w" x "h". @@ -74,10 +69,6 @@ class WebRtcVideoFrame : public VideoFrame { void InitToEmptyBuffer(int w, int h, size_t pixel_width, size_t pixel_height, int64_t time_stamp_ns); - // TODO(magjed): Remove once Chromium is updated. - bool InitToBlack(int w, int h, size_t pixel_width, size_t pixel_height, - int64_t elapsed_time_ns, int64_t time_stamp_ns); - bool InitToBlack(int w, int h, size_t pixel_width, size_t pixel_height, int64_t time_stamp_ns) override;