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

Unified Diff: content/renderer/media/rtc_peer_connection_handler.cc

Issue 1834323002: MediaStream audio: Refactor 3 separate "glue" implementations into one. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reworked unit tests around structural changes, and added exhaustive media_stream_audio_unittest.cc. Created 4 years, 8 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
Index: content/renderer/media/rtc_peer_connection_handler.cc
diff --git a/content/renderer/media/rtc_peer_connection_handler.cc b/content/renderer/media/rtc_peer_connection_handler.cc
index f5aec5e191627aa153d2c99b63cd9887ab8352e2..cfe009845b2d861f3edf622f485234408ddc355c 100644
--- a/content/renderer/media/rtc_peer_connection_handler.cc
+++ b/content/renderer/media/rtc_peer_connection_handler.cc
@@ -22,7 +22,6 @@
#include "base/trace_event/trace_event.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
-#include "content/renderer/media/media_stream_audio_track.h"
#include "content/renderer/media/media_stream_constraints_util.h"
#include "content/renderer/media/media_stream_track.h"
#include "content/renderer/media/peer_connection_tracker.h"
@@ -32,7 +31,6 @@
#include "content/renderer/media/rtc_dtmf_sender_handler.h"
#include "content/renderer/media/webrtc/peer_connection_dependency_factory.h"
#include "content/renderer/media/webrtc/webrtc_media_stream_adapter.h"
-#include "content/renderer/media/webrtc_audio_capturer.h"
#include "content/renderer/media/webrtc_audio_device_impl.h"
#include "content/renderer/media/webrtc_uma_histograms.h"
#include "content/renderer/render_thread_impl.h"
@@ -1485,20 +1483,25 @@ blink::WebRTCDataChannelHandler* RTCPeerConnectionHandler::createDataChannel(
blink::WebRTCDTMFSenderHandler* RTCPeerConnectionHandler::createDTMFSender(
const blink::WebMediaStreamTrack& track) {
DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK(!track.isNull());
TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::createDTMFSender");
DVLOG(1) << "createDTMFSender.";
- MediaStreamAudioTrack* native_track = MediaStreamAudioTrack::From(track);
- if (!native_track || !native_track->is_local_track() ||
- track.source().getType() != blink::WebMediaStreamSource::TypeAudio) {
- DLOG(ERROR) << "The DTMF sender requires a local audio track.";
+ // Find the WebRtc track referenced by the blink track's ID.
+ webrtc::AudioTrackInterface* webrtc_track = nullptr;
+ for (const WebRtcMediaStreamAdapter* s : local_streams_) {
+ webrtc_track = s->webrtc_media_stream()->FindAudioTrack(track.id().utf8());
+ if (webrtc_track)
+ break;
+ }
+ if (!webrtc_track) {
+ DLOG(ERROR) << "Audio track with ID '" << track.id().utf8()
+ << "' has no known WebRtc sink.";
return nullptr;
}
- scoped_refptr<webrtc::AudioTrackInterface> audio_track =
- native_track->GetAudioAdapter();
rtc::scoped_refptr<webrtc::DtmfSenderInterface> sender(
- native_peer_connection_->CreateDtmfSender(audio_track.get()));
+ native_peer_connection_->CreateDtmfSender(webrtc_track));
if (!sender) {
DLOG(ERROR) << "Could not create native DTMF sender.";
return nullptr;

Powered by Google App Engine
This is Rietveld 408576698