Delete obsolete cricket::VideoFrame methods.
GetWidth and GetHeight (renamed to width and height), GetNativeHandle (replaced by video_frame_buffer()->native_handle). TBR=tkchin@webrtc.org (trivial changes to objc RTCVideoFrame and VideoRendererAdapter) BUG=webrtc:5682 Review-Url: https://codereview.webrtc.org/1990063005 Cr-Commit-Position: refs/heads/master@{#12822}
This commit is contained in:
@ -742,7 +742,8 @@ class JavaVideoRendererWrapper
|
||||
|
||||
void OnFrame(const cricket::VideoFrame& video_frame) override {
|
||||
ScopedLocalRefFrame local_ref_frame(jni());
|
||||
jobject j_frame = (video_frame.GetNativeHandle() != nullptr)
|
||||
jobject j_frame =
|
||||
(video_frame.video_frame_buffer()->native_handle() != nullptr)
|
||||
? CricketToJavaTextureFrame(&video_frame)
|
||||
: CricketToJavaI420Frame(&video_frame);
|
||||
// |j_callbacks_| is responsible for releasing |j_frame| with
|
||||
@ -792,8 +793,8 @@ class JavaVideoRendererWrapper
|
||||
|
||||
// Return a VideoRenderer.I420Frame referring texture object in |frame|.
|
||||
jobject CricketToJavaTextureFrame(const cricket::VideoFrame* frame) {
|
||||
NativeHandleImpl* handle =
|
||||
reinterpret_cast<NativeHandleImpl*>(frame->GetNativeHandle());
|
||||
NativeHandleImpl* handle = reinterpret_cast<NativeHandleImpl*>(
|
||||
frame->video_frame_buffer()->native_handle());
|
||||
jfloatArray sampling_matrix = jni()->NewFloatArray(16);
|
||||
jni()->SetFloatArrayRegion(sampling_matrix, 0, 16, handle->sampling_matrix);
|
||||
return jni()->NewObject(
|
||||
|
||||
@ -29,17 +29,6 @@ class VideoFrame {
|
||||
virtual int width() const = 0;
|
||||
virtual int height() const = 0;
|
||||
|
||||
// Deprecated methods, for backwards compatibility.
|
||||
// TODO(nisse): Delete when usage in Chrome and other applications
|
||||
// have been replaced by width() and height().
|
||||
virtual size_t GetWidth() const final { return width(); }
|
||||
virtual size_t GetHeight() const final { return height(); }
|
||||
|
||||
// Returns the handle of the underlying video frame. This is used when the
|
||||
// frame is backed by a texture. The object should be destroyed when it is no
|
||||
// longer in use, so the underlying resource can be freed.
|
||||
virtual void* GetNativeHandle() const = 0;
|
||||
|
||||
// Returns the underlying video frame buffer. This function is ok to call
|
||||
// multiple times, but the returned object will refer to the same memory.
|
||||
virtual const rtc::scoped_refptr<webrtc::VideoFrameBuffer>&
|
||||
|
||||
@ -83,10 +83,6 @@ bool WebRtcVideoFrame::IsExclusive() const {
|
||||
return video_frame_buffer_->IsMutable();
|
||||
}
|
||||
|
||||
void* WebRtcVideoFrame::GetNativeHandle() const {
|
||||
return video_frame_buffer_ ? video_frame_buffer_->native_handle() : nullptr;
|
||||
}
|
||||
|
||||
const rtc::scoped_refptr<webrtc::VideoFrameBuffer>&
|
||||
WebRtcVideoFrame::video_frame_buffer() const {
|
||||
return video_frame_buffer_;
|
||||
@ -193,7 +189,7 @@ const VideoFrame* WebRtcVideoFrame::GetCopyWithRotationApplied() const {
|
||||
// If the video frame is backed up by a native handle, it resides in the GPU
|
||||
// memory which we can't rotate here. The assumption is that the renderers
|
||||
// which uses GPU to render should be able to rotate themselves.
|
||||
RTC_DCHECK(!GetNativeHandle());
|
||||
RTC_DCHECK(!video_frame_buffer()->native_handle());
|
||||
|
||||
if (rotated_frame_) {
|
||||
return rotated_frame_.get();
|
||||
|
||||
@ -68,7 +68,6 @@ class WebRtcVideoFrame : public VideoFrame {
|
||||
int width() const override;
|
||||
int height() const override;
|
||||
|
||||
void* GetNativeHandle() const override;
|
||||
const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& video_frame_buffer()
|
||||
const override;
|
||||
|
||||
|
||||
@ -275,7 +275,7 @@ TEST_F(WebRtcVideoFrameTest, TextureInitialValues) {
|
||||
dummy_handle, 640, 480);
|
||||
// Timestamp is converted from ns to us, so last three digits are lost.
|
||||
cricket::WebRtcVideoFrame frame(buffer, 20000, webrtc::kVideoRotation_0);
|
||||
EXPECT_EQ(dummy_handle, frame.GetNativeHandle());
|
||||
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());
|
||||
@ -294,7 +294,8 @@ TEST_F(WebRtcVideoFrameTest, CopyTextureFrame) {
|
||||
// Timestamp is converted from ns to us, so last three digits are lost.
|
||||
cricket::WebRtcVideoFrame frame1(buffer, 20000, webrtc::kVideoRotation_0);
|
||||
cricket::VideoFrame* frame2 = frame1.Copy();
|
||||
EXPECT_EQ(frame1.GetNativeHandle(), frame2->GetNativeHandle());
|
||||
EXPECT_EQ(frame1.video_frame_buffer()->native_handle(),
|
||||
frame2->video_frame_buffer()->native_handle());
|
||||
EXPECT_EQ(frame1.width(), frame2->width());
|
||||
EXPECT_EQ(frame1.height(), frame2->height());
|
||||
EXPECT_EQ(frame1.GetTimeStamp(), frame2->GetTimeStamp());
|
||||
|
||||
@ -83,12 +83,13 @@
|
||||
}
|
||||
|
||||
- (CVPixelBufferRef)nativeHandle {
|
||||
return static_cast<CVPixelBufferRef>(_videoFrame->GetNativeHandle());
|
||||
return static_cast<CVPixelBufferRef>(
|
||||
_videoFrame->video_frame_buffer()->native_handle());
|
||||
}
|
||||
|
||||
- (void)convertBufferIfNeeded {
|
||||
if (!_i420Buffer) {
|
||||
if (_videoFrame->GetNativeHandle()) {
|
||||
if (_videoFrame->video_frame_buffer()->native_handle()) {
|
||||
// Convert to I420.
|
||||
_i420Buffer = _videoFrame->video_frame_buffer()->NativeToI420Buffer();
|
||||
} else {
|
||||
|
||||
@ -32,7 +32,7 @@ class VideoRendererAdapter
|
||||
// I420 buffer for rotation before calling the rotation method otherwise
|
||||
// it will hit a DCHECK.
|
||||
if (nativeVideoFrame.rotation() != webrtc::kVideoRotation_0 &&
|
||||
nativeVideoFrame.GetNativeHandle()) {
|
||||
nativeVideoFrame.video_frame_buffer()->native_handle()) {
|
||||
rtc::scoped_refptr<webrtc::VideoFrameBuffer> i420Buffer =
|
||||
nativeVideoFrame.video_frame_buffer()->NativeToI420Buffer();
|
||||
std::unique_ptr<cricket::VideoFrame> cpuFrame(
|
||||
|
||||
Reference in New Issue
Block a user