Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: chrome/renderer/media/cast_session.h

Issue 66293003: P2P <-> cast library integration v0.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: adding missing class export Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_RENDERER_MEDIA_CAST_SESSION_H_ 5 #ifndef CHROME_RENDERER_MEDIA_CAST_SESSION_H_
6 #define CHROME_RENDERER_MEDIA_CAST_SESSION_H_ 6 #define CHROME_RENDERER_MEDIA_CAST_SESSION_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "net/base/ip_endpoint.h"
11 12
12 namespace base { 13 namespace base {
13 class MessageLoopProxy; 14 class MessageLoopProxy;
14 } // namespace base 15 } // namespace base
15 16
16 namespace media { 17 namespace media {
17 namespace cast { 18 namespace cast {
18 struct AudioSenderConfig; 19 struct AudioSenderConfig;
19 struct VideoSenderConfig; 20 struct VideoSenderConfig;
20 } // namespace cast 21 } // namespace cast
21 } // namespace media 22 } // namespace media
22 23
24 namespace content{
25 class P2PSocketClient;
26 };
Sergey Ulanov 2013/12/07 01:15:29 nit: remove ;, add comment as for other namespaces
hubbe 2013/12/10 18:25:57 Done.
27
23 class CastSessionDelegate; 28 class CastSessionDelegate;
24 29
25 // This class represents a Cast session and allows the session to be 30 // This class represents a Cast session and allows the session to be
26 // configured on the main thread. Actual work is forwarded to 31 // configured on the main thread. Actual work is forwarded to
27 // CastSessionDelegate on the IO thread. 32 // CastSessionDelegate on the IO thread.
28 class CastSession : public base::RefCounted<CastSession> { 33 class CastSession : public base::RefCounted<CastSession> {
29 public: 34 public:
30 CastSession(); 35 CastSession();
31 36
32 // Start encoding of audio and video using the provided configuration. 37 // Start encoding of audio and video using the provided configuration.
33 void StartAudio(const media::cast::AudioSenderConfig& config); 38 void StartAudio(const media::cast::AudioSenderConfig& config);
34 void StartVideo(const media::cast::VideoSenderConfig& config); 39 void StartVideo(const media::cast::VideoSenderConfig& config);
35 40
41 class SocketFactory {
Sergey Ulanov 2013/12/07 01:15:29 maybe P2PSocketFactory - these are not regular soc
hubbe 2013/12/10 18:25:57 Done.
42 public:
43 virtual ~SocketFactory();
44
45 // Called on IO thread.
46 virtual scoped_refptr<content::P2PSocketClient> create() = 0;
Sergey Ulanov 2013/12/07 01:15:29 Create()
hubbe 2013/12/10 18:25:57 Done.
47 };
48
49 // Send the socket factory to the delegate, where create will be
50 // called. The delegate will then delete the socket factory on the
51 // IO thread. We do it this way because the P2P socket needs to
52 // be created on the same thread that the callbacks will be called on.
53 // The |remote_endpoint| is the address will be used when calling
54 // SendWithDscp on the P2PSocketClient.
55 // Takes ownership of socket_factory.
56 void SetSocketFactory(scoped_ptr<SocketFactory> socket_factory,
57 const net::IPEndPoint& remote_address);
58
36 private: 59 private:
37 friend class base::RefCounted<CastSession>; 60 friend class base::RefCounted<CastSession>;
38 virtual ~CastSession(); 61 virtual ~CastSession();
39 62
40 // This member should never be dereferenced on the main thread. 63 // This member should never be dereferenced on the main thread.
41 // CastSessionDelegate lives only on the IO thread. It is always 64 // CastSessionDelegate lives only on the IO thread. It is always
42 // safe to post task on the IO thread to access CastSessionDelegate 65 // safe to post task on the IO thread to access CastSessionDelegate
43 // because it is owned by this object. 66 // because it is owned by this object.
44 scoped_ptr<CastSessionDelegate> delegate_; 67 scoped_ptr<CastSessionDelegate> delegate_;
45 68
46 // Proxy to the IO message loop. 69 // Proxy to the IO message loop.
47 const scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; 70 const scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
48 71
49 DISALLOW_COPY_AND_ASSIGN(CastSession); 72 DISALLOW_COPY_AND_ASSIGN(CastSession);
50 }; 73 };
51 74
52 #endif // CHROME_RENDERER_MEDIA_CAST_SESSION_H_ 75 #endif // CHROME_RENDERER_MEDIA_CAST_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698