blob: 6bec7f9a3f16d949d9446c225e75ad18134044c6 [file] [log] [blame]
// 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 "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
namespace base {
class MessageLoopProxy;
} // namespace base
namespace media {
namespace cast {
struct AudioSenderConfig;
struct VideoSenderConfig;
} // namespace cast
} // namespace media
class CastSessionDelegate;
// This class represents a Cast session and allows the session to be
// configured on the main thread. Actual work is forwarded to
// CastSessionDelegate on the IO thread.
class CastSession : public base::RefCounted<CastSession> {
// Start encoding of audio and video using the provided configuration.
void StartAudio(const media::cast::AudioSenderConfig& config);
void StartVideo(const media::cast::VideoSenderConfig& config);
friend class base::RefCounted<CastSession>;
virtual ~CastSession();
// This member should never be dereferenced on the main thread.
// CastSessionDelegate lives only on the IO thread. It is always
// safe to post task on the IO thread to access CastSessionDelegate
// because it is owned by this object.
scoped_ptr<CastSessionDelegate> delegate_;
// Proxy to the IO message loop.
const scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;