blob: f96c92b336f4fc31563c37704c518fb4a6eea10f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/public/renderer/media_stream_audio_sink.h"
#include "base/logging.h"
#include "content/renderer/media/media_stream_track_extra_data.h"
#include "content/renderer/media/webrtc_local_audio_track.h"
#include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
#include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
namespace content {
void MediaStreamAudioSink::AddToAudioTrack(
MediaStreamAudioSink* sink,
const blink::WebMediaStreamTrack& track) {
DCHECK(track.source().type() == blink::WebMediaStreamSource::TypeAudio);
MediaStreamTrackExtraData* extra_data =
static_cast<MediaStreamTrackExtraData*>(track.extraData());
// TODO(xians): Support remote audio track.
DCHECK(extra_data->is_local_track());
WebRtcLocalAudioTrack* audio_track =
static_cast<WebRtcLocalAudioTrack*>(extra_data->track().get());
audio_track->AddSink(sink);
}
void MediaStreamAudioSink::RemoveFromAudioTrack(
MediaStreamAudioSink* sink,
const blink::WebMediaStreamTrack& track) {
MediaStreamTrackExtraData* extra_data =
static_cast<MediaStreamTrackExtraData*>(track.extraData());
// TODO(xians): Support remote audio track.
DCHECK(extra_data->is_local_track());
WebRtcLocalAudioTrack* audio_track =
static_cast<WebRtcLocalAudioTrack*>(extra_data->track().get());
audio_track->RemoveSink(sink);
}
} // namespace content
|