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

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

Issue 2348533002: Reland Replace interface VideoCapturerInput with VideoSinkInterface. (Closed)
Patch Set: Fix rtp timestamp in quality test. Created 4 years, 3 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/engine/webrtcvideoengine2.h ('k') | webrtc/test/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/engine/webrtcvideoengine2.cc
diff --git a/webrtc/media/engine/webrtcvideoengine2.cc b/webrtc/media/engine/webrtcvideoengine2.cc
index 60f51be8d1615aff560bfe43407bcab06acc770d..8a2b373d914510502a2f71b7a9ec8e487f5f8081 100644
--- a/webrtc/media/engine/webrtcvideoengine2.cc
+++ b/webrtc/media/engine/webrtcvideoengine2.cc
@@ -1580,6 +1580,7 @@ WebRtcVideoChannel2::WebRtcVideoSendStream::WebRtcVideoSendStream(
source_(nullptr),
external_encoder_factory_(external_encoder_factory),
stream_(nullptr),
+ encoder_sink_(nullptr),
parameters_(std::move(config), options, max_bitrate_bps, codec_settings),
rtp_parameters_(CreateRtpParametersWithOneEncoding()),
pending_encoder_reconfiguration_(false),
@@ -1658,7 +1659,7 @@ void WebRtcVideoChannel2::WebRtcVideoSendStream::OnFrame(
<< ", texture=" << last_frame_info_.is_texture;
}
- if (stream_ == NULL) {
+ if (encoder_sink_ == NULL) {
// Frame input before send codecs are configured, dropping frame.
return;
}
@@ -1681,7 +1682,7 @@ void WebRtcVideoChannel2::WebRtcVideoSendStream::OnFrame(
if (cpu_restricted_counter_ > 0)
++cpu_restricted_frame_count_;
- stream_->Input()->IncomingCapturedFrame(video_frame);
+ encoder_sink_->OnFrame(video_frame);
}
bool WebRtcVideoChannel2::WebRtcVideoSendStream::SetVideoSend(
@@ -1704,7 +1705,7 @@ bool WebRtcVideoChannel2::WebRtcVideoSendStream::SetVideoSend(
if (options_present) {
VideoOptions old_options = parameters_.options;
parameters_.options.SetAll(*options);
- // Reconfigure encoder settings on the naext frame or stream
+ // Reconfigure encoder settings on the next frame or stream
// recreation if the options changed.
if (parameters_.options != old_options) {
pending_encoder_reconfiguration_ = true;
@@ -1712,7 +1713,7 @@ bool WebRtcVideoChannel2::WebRtcVideoSendStream::SetVideoSend(
}
if (source_changing) {
- if (source == nullptr && stream_ != nullptr) {
+ if (source == nullptr && encoder_sink_ != nullptr) {
LOG(LS_VERBOSE) << "Disabling capturer, sending black frame.";
// Force this black frame not to be dropped due to timestamp order
// check. As IncomingCapturedFrame will drop the frame if this frame's
@@ -1725,9 +1726,8 @@ bool WebRtcVideoChannel2::WebRtcVideoSendStream::SetVideoSend(
last_frame_info_.height));
black_buffer->SetToBlack();
- stream_->Input()->IncomingCapturedFrame(webrtc::VideoFrame(
- black_buffer, last_frame_info_.rotation,
- last_frame_timestamp_us_));
+ encoder_sink_->OnFrame(webrtc::VideoFrame(
+ black_buffer, last_frame_info_.rotation, last_frame_timestamp_us_));
}
source_ = source;
}
@@ -1743,7 +1743,7 @@ bool WebRtcVideoChannel2::WebRtcVideoSendStream::SetVideoSend(
void WebRtcVideoChannel2::WebRtcVideoSendStream::DisconnectSource() {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
- if (source_ == NULL) {
+ if (source_ == nullptr) {
return;
}
@@ -2049,6 +2049,23 @@ void WebRtcVideoChannel2::WebRtcVideoSendStream::SetSend(bool send) {
UpdateSendState();
}
+void WebRtcVideoChannel2::WebRtcVideoSendStream::AddOrUpdateSink(
+ VideoSinkInterface<webrtc::VideoFrame>* sink,
+ const rtc::VideoSinkWants& wants) {
+ // TODO(perkj): Actually consider the encoder |wants| and remove
+ // WebRtcVideoSendStream::OnLoadUpdate(Load load).
+ rtc::CritScope cs(&lock_);
+ RTC_DCHECK(!encoder_sink_ || encoder_sink_ == sink);
+ encoder_sink_ = sink;
+}
+
+void WebRtcVideoChannel2::WebRtcVideoSendStream::RemoveSink(
+ VideoSinkInterface<webrtc::VideoFrame>* sink) {
+ rtc::CritScope cs(&lock_);
+ RTC_DCHECK_EQ(encoder_sink_, sink);
+ encoder_sink_ = nullptr;
+}
+
void WebRtcVideoChannel2::WebRtcVideoSendStream::OnLoadUpdate(Load load) {
if (worker_thread_ != rtc::Thread::Current()) {
invoker_.AsyncInvoke<void>(
@@ -2241,6 +2258,7 @@ void WebRtcVideoChannel2::WebRtcVideoSendStream::RecreateWebRtcStream() {
}
stream_ = call_->CreateVideoSendStream(std::move(config),
parameters_.encoder_config.Copy());
+ stream_->SetSource(this);
parameters_.encoder_config.encoder_specific_settings = NULL;
pending_encoder_reconfiguration_ = false;
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.h ('k') | webrtc/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698