summaryrefslogtreecommitdiffstats
path: root/content/renderer/media/media_stream_extra_data.h
blob: afac9c350a2139f21660d36467957383637a911e (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
44
45
46
47
// Copyright (c) 2012 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.

#ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_EXTRA_DATA_H_
#define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_EXTRA_DATA_H_

#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "content/common/content_export.h"
#include "third_party/WebKit/public/platform/WebMediaStream.h"

namespace webrtc {
class MediaStreamInterface;
}  // namespace webrtc

namespace content {

class CONTENT_EXPORT MediaStreamExtraData
    : NON_EXPORTED_BASE(public WebKit::WebMediaStream::ExtraData) {
 public:
  typedef base::Callback<void(const std::string& label)> StreamStopCallback;

  MediaStreamExtraData(webrtc::MediaStreamInterface* stream, bool is_local);
  virtual ~MediaStreamExtraData();

  bool is_local() const { return is_local_; }

  void SetLocalStreamStopCallback(
      const StreamStopCallback& stop_callback);
  void OnLocalStreamStop();

  const scoped_refptr<webrtc::MediaStreamInterface>& stream() const {
    return stream_;
  }
 private:
  StreamStopCallback stream_stop_callback_;
  scoped_refptr<webrtc::MediaStreamInterface> stream_;
  bool is_local_;

  DISALLOW_COPY_AND_ASSIGN(MediaStreamExtraData);
};

}  // namespace content

#endif  // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_EXTRA_DATA_H_