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

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: merge 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
17 namespace content{
18 class P2PSocketClient;
19 };
16 namespace media { 20 namespace media {
17 namespace cast { 21 namespace cast {
18 struct AudioSenderConfig; 22 struct AudioSenderConfig;
19 struct VideoSenderConfig; 23 struct VideoSenderConfig;
20 } // namespace cast 24 } // namespace cast
21 } // namespace media 25 } // namespace media
22 26
23 class CastSessionDelegate; 27 class CastSessionDelegate;
24 28
25 // This class represents a Cast session and allows the session to be 29 // This class represents a Cast session and allows the session to be
26 // configured on the main thread. Actual work is forwarded to 30 // configured on the main thread. Actual work is forwarded to
27 // CastSessionDelegate on the IO thread. 31 // CastSessionDelegate on the IO thread.
28 class CastSession : public base::RefCounted<CastSession> { 32 class CastSession : public base::RefCounted<CastSession> {
29 public: 33 public:
30 CastSession(); 34 CastSession();
31 35
36 class SocketFactory {
37 public:
38 virtual ~SocketFactory();
39
40 // Called on IO thread.
41 virtual scoped_refptr<content::P2PSocketClient> create() = 0;
42 };
43
44 // Send the socket factory to the delegate, where create will be
45 // called. The delegate will then delete the socket factory on the
46 // IO thread. We do it this way because the P2P socket needs to
47 // be created on the same thread that the callbacks will be called on.
48 // The |remote_endpoint| is the address will be used when calling
49 // SendWithDscp on the P2PSocketClient.
50 // Takes ownership of socket_factory.
51 void SetSocketFactory(scoped_ptr<SocketFactory> socket_factory,
52 const net::IPEndPoint& remote_address);
53
32 // Start encoding of audio and video using the provided configuration. 54 // Start encoding of audio and video using the provided configuration.
33 void StartAudio(const media::cast::AudioSenderConfig& config); 55 void StartAudio(const media::cast::AudioSenderConfig& config);
34 void StartVideo(const media::cast::VideoSenderConfig& config); 56 void StartVideo(const media::cast::VideoSenderConfig& config);
35 57
36 private: 58 private:
37 friend class base::RefCounted<CastSession>; 59 friend class base::RefCounted<CastSession>;
38 virtual ~CastSession(); 60 virtual ~CastSession();
39 61
40 // This member should never be dereferenced on the main thread. 62 // This member should never be dereferenced on the main thread.
41 // CastSessionDelegate lives only on the IO thread. It is always 63 // CastSessionDelegate lives only on the IO thread. It is always
42 // safe to post task on the IO thread to access CastSessionDelegate 64 // safe to post task on the IO thread to access CastSessionDelegate
43 // because it is owned by this object. 65 // because it is owned by this object.
44 scoped_ptr<CastSessionDelegate> delegate_; 66 scoped_ptr<CastSessionDelegate> delegate_;
45 67
46 // Proxy to the IO message loop. 68 // Proxy to the IO message loop.
47 const scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; 69 const scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
48 70
49 DISALLOW_COPY_AND_ASSIGN(CastSession); 71 DISALLOW_COPY_AND_ASSIGN(CastSession);
50 }; 72 };
51 73
52 #endif // CHROME_RENDERER_MEDIA_CAST_SESSION_H_ 74 #endif // CHROME_RENDERER_MEDIA_CAST_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698