summaryrefslogtreecommitdiffstats
path: root/content/renderer/media/media_stream_track.cc
blob: 1846b17548846d6681e4ec9d1a12b12ab7363611 (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
41
42
43
// Copyright 2014 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/renderer/media/media_stream_track.h"

#include "base/logging.h"
#include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h"

namespace content {

MediaStreamTrack* MediaStreamTrack::GetTrack(
    const blink::WebMediaStreamTrack& track) {
  if (track.isNull())
    return NULL;
  return static_cast<MediaStreamTrack*>(track.extraData());
}

MediaStreamTrack::MediaStreamTrack(
    webrtc::MediaStreamTrackInterface* track, bool is_local_track)
    : track_(track),
      is_local_track_(is_local_track) {
}

MediaStreamTrack::~MediaStreamTrack() {
}

void MediaStreamTrack::SetEnabled(bool enabled) {
  if (track_)
    track_->set_enabled(enabled);
}

webrtc::AudioTrackInterface* MediaStreamTrack::GetAudioAdapter() {
  return static_cast<webrtc::AudioTrackInterface*>(track_.get());
}

webrtc::VideoTrackInterface* MediaStreamTrack::GetVideoAdapter() {
  NOTREACHED();
  return NULL;
}

}  // namespace content