Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(685)

Unified Diff: content/renderer/media/webrtc/media_stream_remote_video_source.cc

Issue 2068703002: Delete only call to cricket::VideoFrame::Copy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/webrtc/media_stream_remote_video_source.cc
diff --git a/content/renderer/media/webrtc/media_stream_remote_video_source.cc b/content/renderer/media/webrtc/media_stream_remote_video_source.cc
index 928b1804c68b10b67600d1f18e9533b867f2db87..7fc2ddc6e386e26b62653f344a85e9441e779a3f 100644
--- a/content/renderer/media/webrtc/media_stream_remote_video_source.cc
+++ b/content/renderer/media/webrtc/media_stream_remote_video_source.cc
@@ -89,16 +89,17 @@ void MediaStreamRemoteVideoSource::RemoteVideoSourceDelegate::OnFrame(
incoming_timestamp - start_timestamp_;
scoped_refptr<media::VideoFrame> video_frame;
- if (incoming_frame.video_frame_buffer()->native_handle() != NULL) {
+ scoped_refptr<webrtc::VideoFrameBuffer> buffer(
+ incoming_frame.video_frame_buffer());
+
+ if (buffer->native_handle() != NULL) {
video_frame =
- static_cast<media::VideoFrame*>(
- incoming_frame.video_frame_buffer()->native_handle());
+ static_cast<media::VideoFrame*>(buffer->native_handle());
video_frame->set_timestamp(elapsed_timestamp);
} else {
- const cricket::VideoFrame* frame =
- incoming_frame.GetCopyWithRotationApplied();
-
- gfx::Size size(frame->width(), frame->height());
+ buffer =
+ incoming_frame.GetCopyWithRotationApplied()->video_frame_buffer();
nisse-chromium (ooo August 14) 2016/06/14 13:06:58 This looks a bit silly. Should there be a rotate m
+ gfx::Size size(buffer->width(), buffer->height());
// Make a shallow copy. Both |frame| and |video_frame| will share a single
// reference counted frame buffer. Const cast and hope no one will overwrite
@@ -107,17 +108,19 @@ void MediaStreamRemoteVideoSource::RemoteVideoSourceDelegate::OnFrame(
// need to const cast here.
video_frame = media::VideoFrame::WrapExternalYuvData(
media::PIXEL_FORMAT_YV12, size, gfx::Rect(size), size,
- frame->video_frame_buffer()->StrideY(),
- frame->video_frame_buffer()->StrideU(),
- frame->video_frame_buffer()->StrideV(),
- const_cast<uint8_t*>(frame->video_frame_buffer()->DataY()),
- const_cast<uint8_t*>(frame->video_frame_buffer()->DataU()),
- const_cast<uint8_t*>(frame->video_frame_buffer()->DataV()),
+ buffer->StrideY(),
+ buffer->StrideU(),
+ buffer->StrideV(),
+ const_cast<uint8_t*>(buffer->DataY()),
+ const_cast<uint8_t*>(buffer->DataU()),
+ const_cast<uint8_t*>(buffer->DataV()),
elapsed_timestamp);
if (!video_frame)
return;
video_frame->AddDestructionObserver(
- base::Bind(&base::DeletePointer<cricket::VideoFrame>, frame->Copy()));
+ base::Bind(
+ &base::DeletePointer<scoped_refptr<webrtc::VideoFrameBuffer>>,
+ new scoped_refptr<webrtc::VideoFrameBuffer>(buffer)));
nisse-chromium (ooo August 14) 2016/06/14 13:06:58 There ought to be some better way to do this, with
perkj_chrome 2016/06/14 13:59:28 video_frame->AddDestructionObserver( base:
nisse-chromium (ooo August 14) 2016/06/15 06:45:46 The compiler didn't like a lambda here, but bindin
}
video_frame->metadata()->SetTimeTicks(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698