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

Unified Diff: webrtc/media/webrtc/webrtcvideoengine2.cc

Issue 1687273002: Revert of Make cricket::VideoCapturer implement VideoSourceInterface (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 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 | « webrtc/media/webrtc/webrtcvideoengine2.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/webrtc/webrtcvideoengine2.cc
diff --git a/webrtc/media/webrtc/webrtcvideoengine2.cc b/webrtc/media/webrtc/webrtcvideoengine2.cc
index b968322ee3db9d31998bbf513cd9a209bad86ab3..c2b65ced276d0e9a85bee4fd4d37d3ab06b2cc9f 100644
--- a/webrtc/media/webrtc/webrtcvideoengine2.cc
+++ b/webrtc/media/webrtc/webrtcvideoengine2.cc
@@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#ifdef HAVE_WEBRTC_VIDEO
#include "webrtc/media/webrtc/webrtcvideoengine2.h"
#include <algorithm>
@@ -969,7 +970,7 @@
bool WebRtcVideoChannel2::ValidateSendSsrcAvailability(
const StreamParams& sp) const {
- for (uint32_t ssrc : sp.ssrcs) {
+ for (uint32_t ssrc: sp.ssrcs) {
if (send_ssrcs_.find(ssrc) != send_ssrcs_.end()) {
LOG(LS_ERROR) << "Send stream with SSRC '" << ssrc << "' already exists.";
return false;
@@ -980,7 +981,7 @@
bool WebRtcVideoChannel2::ValidateReceiveSsrcAvailability(
const StreamParams& sp) const {
- for (uint32_t ssrc : sp.ssrcs) {
+ for (uint32_t ssrc: sp.ssrcs) {
if (receive_ssrcs_.find(ssrc) != receive_ssrcs_.end()) {
LOG(LS_ERROR) << "Receive stream with SSRC '" << ssrc
<< "' already exists.";
@@ -1285,6 +1286,11 @@
if (!send_streams_[ssrc]->SetCapturer(capturer)) {
return false;
}
+ }
+
+ if (capturer) {
+ capturer->SetApplyRotation(!ContainsHeaderExtension(
+ send_rtp_extensions_, kRtpVideoRotationHeaderExtension));
}
{
rtc::CritScope lock(&capturer_crit_);
@@ -1549,11 +1555,12 @@
video_frame->allocated_size(webrtc::kVPlane));
}
-void WebRtcVideoChannel2::WebRtcVideoSendStream::OnFrame(
- const VideoFrame& frame) {
- TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::OnFrame");
- webrtc::VideoFrame video_frame(frame.GetVideoFrameBuffer(), 0, 0,
- frame.GetVideoRotation());
+void WebRtcVideoChannel2::WebRtcVideoSendStream::InputFrame(
+ VideoCapturer* capturer,
+ const VideoFrame* frame) {
+ TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::InputFrame");
+ webrtc::VideoFrame video_frame(frame->GetVideoFrameBuffer(), 0, 0,
+ frame->GetVideoRotation());
rtc::CritScope cs(&lock_);
if (stream_ == NULL) {
// Frame input before send codecs are configured, dropping frame.
@@ -1567,11 +1574,12 @@
if (muted_) {
// Create a black frame to transmit instead.
- CreateBlackFrame(&video_frame, static_cast<int>(frame.GetWidth()),
- static_cast<int>(frame.GetHeight()));
- }
-
- int64_t frame_delta_ms = frame.GetTimeStamp() / rtc::kNumNanosecsPerMillisec;
+ CreateBlackFrame(&video_frame,
+ static_cast<int>(frame->GetWidth()),
+ static_cast<int>(frame->GetHeight()));
+ }
+
+ int64_t frame_delta_ms = frame->GetTimeStamp() / rtc::kNumNanosecsPerMillisec;
// frame->GetTimeStamp() is essentially a delta, align to webrtc time
if (first_frame_timestamp_ms_ == 0) {
first_frame_timestamp_ms_ = rtc::Time() - frame_delta_ms;
@@ -1580,8 +1588,8 @@
last_frame_timestamp_ms_ = first_frame_timestamp_ms_ + frame_delta_ms;
video_frame.set_render_time_ms(last_frame_timestamp_ms_);
// Reconfigure codec if necessary.
- SetDimensions(video_frame.width(), video_frame.height(),
- capturer_->IsScreencast());
+ SetDimensions(
+ video_frame.width(), video_frame.height(), capturer->IsScreencast());
stream_->Input()->IncomingCapturedFrame(video_frame);
}
@@ -1623,8 +1631,10 @@
}
capturer_ = capturer;
- capturer_->AddOrUpdateSink(this, sink_wants_);
- }
+ }
+ // Lock cannot be held while connecting the capturer to prevent lock-order
+ // violations.
+ capturer->SignalVideoFrame.connect(this, &WebRtcVideoSendStream::InputFrame);
return true;
}
@@ -1646,8 +1656,7 @@
capturer = capturer_;
capturer_ = NULL;
}
- capturer->RemoveSink(this);
-
+ capturer->SignalVideoFrame.disconnect(this);
return true;
}
@@ -1785,10 +1794,9 @@
}
if (params.rtp_header_extensions) {
parameters_.config.rtp.extensions = *params.rtp_header_extensions;
- sink_wants_.rotation_applied = !ContainsHeaderExtension(
- *params.rtp_header_extensions, kRtpVideoRotationHeaderExtension);
if (capturer_) {
- capturer_->AddOrUpdateSink(this, sink_wants_);
+ capturer_->SetApplyRotation(!ContainsHeaderExtension(
+ *params.rtp_header_extensions, kRtpVideoRotationHeaderExtension));
}
recreate_stream = true;
}
@@ -2497,3 +2505,5 @@
}
} // namespace cricket
+
+#endif // HAVE_WEBRTC_VIDEO
« no previous file with comments | « webrtc/media/webrtc/webrtcvideoengine2.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698