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

Side by Side Diff: content/renderer/media/webrtc/media_stream_remote_video_source.cc

Issue 2925313002: Update WebRtcVideoFrameAdapter to new buffer interface (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/webrtc/media_stream_remote_video_source.h" 5 #include "content/renderer/media/webrtc/media_stream_remote_video_source.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/callback_helpers.h" 11 #include "base/callback_helpers.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/trace_event/trace_event.h" 13 #include "base/trace_event/trace_event.h"
14 #include "content/renderer/media/webrtc/track_observer.h" 14 #include "content/renderer/media/webrtc/track_observer.h"
15 #include "content/renderer/media/webrtc/webrtc_video_frame_adapter.h"
15 #include "media/base/bind_to_current_loop.h" 16 #include "media/base/bind_to_current_loop.h"
16 #include "media/base/timestamp_constants.h" 17 #include "media/base/timestamp_constants.h"
17 #include "media/base/video_frame.h" 18 #include "media/base/video_frame.h"
18 #include "media/base/video_util.h" 19 #include "media/base/video_util.h"
19 #include "third_party/webrtc/api/video/i420_buffer.h" 20 #include "third_party/webrtc/api/video/i420_buffer.h"
20 #include "third_party/webrtc/media/base/videosinkinterface.h" 21 #include "third_party/webrtc/media/base/videosinkinterface.h"
21 22
22 namespace content { 23 namespace content {
23 24
24 namespace { 25 namespace {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 CHECK_NE(media::kNoTimestamp, incoming_timestamp); 109 CHECK_NE(media::kNoTimestamp, incoming_timestamp);
109 if (start_timestamp_ == media::kNoTimestamp) 110 if (start_timestamp_ == media::kNoTimestamp)
110 start_timestamp_ = incoming_timestamp; 111 start_timestamp_ = incoming_timestamp;
111 const base::TimeDelta elapsed_timestamp = 112 const base::TimeDelta elapsed_timestamp =
112 incoming_timestamp - start_timestamp_; 113 incoming_timestamp - start_timestamp_;
113 114
114 scoped_refptr<media::VideoFrame> video_frame; 115 scoped_refptr<media::VideoFrame> video_frame;
115 scoped_refptr<webrtc::VideoFrameBuffer> buffer( 116 scoped_refptr<webrtc::VideoFrameBuffer> buffer(
116 incoming_frame.video_frame_buffer()); 117 incoming_frame.video_frame_buffer());
117 118
118 if (buffer->native_handle() != NULL) { 119 if (buffer->type() == webrtc::VideoFrameBuffer::Type::kNative) {
119 video_frame = static_cast<media::VideoFrame*>(buffer->native_handle()); 120 video_frame = static_cast<WebRtcVideoFrameAdapter*>(buffer.get())
121 ->getMediaVideoFrame();
120 video_frame->set_timestamp(elapsed_timestamp); 122 video_frame->set_timestamp(elapsed_timestamp);
121 if (incoming_frame.rotation() != webrtc::kVideoRotation_0) { 123 if (incoming_frame.rotation() != webrtc::kVideoRotation_0) {
122 video_frame->metadata()->SetRotation( 124 video_frame->metadata()->SetRotation(
123 media::VideoFrameMetadata::ROTATION, 125 media::VideoFrameMetadata::ROTATION,
124 WebRTCToMediaVideoRotation(incoming_frame.rotation())); 126 WebRTCToMediaVideoRotation(incoming_frame.rotation()));
125 } 127 }
126 } else { 128 } else {
127 buffer = webrtc::I420Buffer::Rotate(*incoming_frame.video_frame_buffer(), 129 buffer = webrtc::I420Buffer::Rotate(*incoming_frame.video_frame_buffer(),
128 incoming_frame.rotation()); 130 incoming_frame.rotation());
129 131
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 case webrtc::MediaStreamTrackInterface::kEnded: 243 case webrtc::MediaStreamTrackInterface::kEnded:
242 SetReadyState(blink::WebMediaStreamSource::kReadyStateEnded); 244 SetReadyState(blink::WebMediaStreamSource::kReadyStateEnded);
243 break; 245 break;
244 default: 246 default:
245 NOTREACHED(); 247 NOTREACHED();
246 break; 248 break;
247 } 249 }
248 } 250 }
249 251
250 } // namespace content 252 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698