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

Unified Diff: remoting/protocol/webrtc_connection_to_host.cc

Issue 2371323007: Add audio support in WebrtcConnectionToHost, audio unittest (Closed)
Patch Set: more reliable test Created 4 years, 2 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_connection_to_host.h ('k') | remoting/protocol/webrtc_transport.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/webrtc_connection_to_host.cc
diff --git a/remoting/protocol/webrtc_connection_to_host.cc b/remoting/protocol/webrtc_connection_to_host.cc
index 1ab485b3d7535eb3f27ac446c48a8900d592cfed..1e0c78878df2742c8b2c8b9469ae6faf8db45f79 100644
--- a/remoting/protocol/webrtc_connection_to_host.cc
+++ b/remoting/protocol/webrtc_connection_to_host.cc
@@ -16,6 +16,8 @@
#include "remoting/protocol/message_pipe.h"
#include "remoting/protocol/transport_context.h"
#include "remoting/protocol/video_renderer.h"
+#include "remoting/protocol/webrtc_audio_module.h"
+#include "remoting/protocol/webrtc_audio_sink_adapter.h"
#include "remoting/protocol/webrtc_transport.h"
#include "remoting/protocol/webrtc_video_renderer_adapter.h"
@@ -35,6 +37,8 @@ void WebrtcConnectionToHost::Connect(
transport_.reset(new WebrtcTransport(
jingle_glue::JingleThreadWrapper::current(), transport_context, this));
+ transport_->audio_module()->SetAudioTaskRunner(audio_decode_task_runner_);
+
session_ = std::move(session);
session_->SetEventHandler(this);
session_->SetTransport(transport_.get());
@@ -74,8 +78,9 @@ void WebrtcConnectionToHost::set_video_renderer(VideoRenderer* video_renderer) {
void WebrtcConnectionToHost::InitializeAudio(
scoped_refptr<base::SingleThreadTaskRunner> audio_decode_task_runner,
- base::WeakPtr<AudioStub> audio_stub) {
- NOTIMPLEMENTED();
+ base::WeakPtr<AudioStub> audio_consumer) {
+ audio_decode_task_runner_ = audio_decode_task_runner;
+ audio_consumer_ = audio_consumer;
}
void WebrtcConnectionToHost::OnSessionStateChange(Session::State state) {
@@ -144,7 +149,13 @@ void WebrtcConnectionToHost::OnWebrtcTransportIncomingDataChannel(
void WebrtcConnectionToHost::OnWebrtcTransportMediaStreamAdded(
scoped_refptr<webrtc::MediaStreamInterface> stream) {
- GetOrCreateVideoAdapter(stream->label())->SetMediaStream(stream);
+ if (stream->GetVideoTracks().size() > 0) {
+ GetOrCreateVideoAdapter(stream->label())->SetMediaStream(stream);
+ } else if (stream->GetAudioTracks().size() > 0) {
+ audio_adapter_.reset(new WebrtcAudioSinkAdapter(stream, audio_consumer_));
+ } else {
+ LOG(ERROR) << "Received MediaStream with no video or audio tracks.";
+ }
}
void WebrtcConnectionToHost::OnWebrtcTransportMediaStreamRemoved(
« no previous file with comments | « remoting/protocol/webrtc_connection_to_host.h ('k') | remoting/protocol/webrtc_transport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698