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

Unified Diff: remoting/protocol/webrtc_video_stream.cc

Issue 2782523003: [Remoting Host] Supporting WebRTC VP9 streaming (Closed)
Patch Set: Fix Feedback Created 3 years, 9 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 | « remoting/protocol/webrtc_video_stream.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/webrtc_video_stream.cc
diff --git a/remoting/protocol/webrtc_video_stream.cc b/remoting/protocol/webrtc_video_stream.cc
index 79a7dceaeff038df1c6854fba7f759e6120de651..72835251cd465d78eef2627df6787903b277e166 100644
--- a/remoting/protocol/webrtc_video_stream.cc
+++ b/remoting/protocol/webrtc_video_stream.cc
@@ -4,6 +4,8 @@
#include "remoting/protocol/webrtc_video_stream.h"
+#include <utility>
+
#include "base/logging.h"
#include "base/single_thread_task_runner.h"
#include "base/task_runner_util.h"
@@ -76,8 +78,11 @@ void WebrtcVideoStream::Start(
encode_task_runner_ = std::move(encode_task_runner);
capturer_ = std::move(desktop_capturer);
webrtc_transport_ = webrtc_transport;
- // TODO(isheriff): make this codec independent
- encoder_ = WebrtcVideoEncoderVpx::CreateForVP8();
+
+ webrtc_transport_->video_encoder_factory()->RegisterEncoderSelectedCallback(
+ base::Bind(&WebrtcVideoStream::OnEncoderCreated,
+ weak_factory_.GetWeakPtr()));
+
capturer_->Start(this);
// Set video stream constraints.
@@ -164,6 +169,8 @@ void WebrtcVideoStream::OnCaptureResult(
}
}
+ DCHECK(encoder_);
+
base::PostTaskAndReplyWithResult(
encode_task_runner_.get(), FROM_HERE,
base::Bind(&WebrtcVideoStream::EncodeFrame, encoder_.get(),
@@ -261,5 +268,16 @@ void WebrtcVideoStream::OnFrameEncoded(EncodedFrameWithStats frame) {
}
}
+void WebrtcVideoStream::OnEncoderCreated(webrtc::VideoCodecType codec_type) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ if (codec_type == webrtc::kVideoCodecVP8) {
+ encoder_ = WebrtcVideoEncoderVpx::CreateForVP8();
+ } else if (codec_type == webrtc::kVideoCodecVP9) {
+ encoder_ = WebrtcVideoEncoderVpx::CreateForVP9();
+ } else {
+ LOG(FATAL) << "Unknown codec type: " << codec_type;
+ }
+}
+
} // namespace protocol
} // namespace remoting
« no previous file with comments | « remoting/protocol/webrtc_video_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698