#ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_H_
#define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_H_
#include <string>
#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 content {
class MediaStreamDependencyFactory;
class CONTENT_EXPORT MediaStream
: NON_EXPORTED_BASE(public blink::WebMediaStream::ExtraData) {
public:
typedef base::Callback<void(const std::string& label)> StreamStopCallback;
MediaStream(MediaStreamDependencyFactory* factory,
StreamStopCallback stream_stop,
const blink::WebMediaStream& stream);
explicit MediaStream(webrtc::MediaStreamInterface* stream);
virtual ~MediaStream();
static MediaStream* GetMediaStream(
const blink::WebMediaStream& stream);
static webrtc::MediaStreamInterface* GetAdapter(
const blink::WebMediaStream& stream);
bool is_local() const { return is_local_; }
void OnStreamStopped();
bool AddTrack(const blink::WebMediaStream& stream,
const blink::WebMediaStreamTrack& track);
bool RemoveTrack(const blink::WebMediaStream& stream,
const blink::WebMediaStreamTrack& track);
protected:
virtual webrtc::MediaStreamInterface* GetWebRtcAdapter(
const blink::WebMediaStream& stream);
private:
StreamStopCallback stream_stop_callback_;
scoped_refptr<webrtc::MediaStreamInterface> stream_adapter_;
const bool is_local_;
const std::string label_;
MediaStreamDependencyFactory* factory_;
DISALLOW_COPY_AND_ASSIGN(MediaStream);
};
}
#endif