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

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

Issue 66293003: P2P <-> cast library integration v0.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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_DELEGATE_H_ 5 #ifndef CHROME_RENDERER_MEDIA_CAST_SESSION_DELEGATE_H_
6 #define CHROME_RENDERER_MEDIA_CAST_SESSION_DELEGATE_H_ 6 #define CHROME_RENDERER_MEDIA_CAST_SESSION_DELEGATE_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/threading/thread.h" 10 #include "base/threading/thread.h"
11 #include "base/threading/thread_checker.h" 11 #include "base/threading/thread_checker.h"
12 #include "base/time/default_tick_clock.h" 12 #include "base/time/default_tick_clock.h"
13 #include "chrome/renderer/media/cast_session.h"
14 #include "content/public/renderer/p2p_socket_client.h"
15 #include "media/cast/cast_sender.h"
13 16
14 namespace base { 17 namespace base {
15 class MessageLoopProxy; 18 class MessageLoopProxy;
16 } // namespace base 19 } // namespace base
17 20
18 namespace media {
19 namespace cast {
20 class CastEnvironment;
21 class CastSender;
22 } // namespace cast
23 } // namespace media
24
25 // This class hosts CastSender and connects it to audio/video frame input 21 // This class hosts CastSender and connects it to audio/video frame input
26 // and network socket. 22 // and network socket.
27 // This class is created on the render thread and destroyed on the IO 23 // This class is created on the render thread and destroyed on the IO
28 // thread. All methods are accessible only on the IO thread. 24 // thread. All methods are accessible only on the IO thread.
29 class CastSessionDelegate { 25 class CastSessionDelegate
26 : public media::cast::PacketSender,
27 public content::P2PSocketClient::Delegate {
30 public: 28 public:
31 CastSessionDelegate(); 29 CastSessionDelegate();
32 ~CastSessionDelegate(); 30 virtual ~CastSessionDelegate();
31
32 void SetSocketFactory(CastSession::SocketFactory* socket_factory,
33 const net::IPEndPoint& remote_address);
33 34
34 // Start encoding threads and configure CastSender. It is ready to accept 35 // Start encoding threads and configure CastSender. It is ready to accept
35 // audio/video frames after this call. 36 // audio/video frames after this call.
36 void PrepareForSending(); 37 void PrepareForSending();
37 38
39 // media::cast::PacketSender Implementation
40 virtual bool SendPacket(const media::cast::Packet& packet) OVERRIDE;
41 virtual bool SendPackets(const media::cast::PacketList& packets) OVERRIDE;
42
43 // content::P2PSocketClient::Delegate Implementation
44 virtual void OnOpen(const net::IPEndPoint& address) OVERRIDE;
45 virtual void OnIncomingTcpConnection(
46 const net::IPEndPoint& address,
47 content::P2PSocketClient* client) OVERRIDE;
48 virtual void OnSendComplete() OVERRIDE;
49 virtual void OnError() OVERRIDE;
50 virtual void OnDataReceived(const net::IPEndPoint& address,
51 const std::vector<char>& data) OVERRIDE;
38 private: 52 private:
39 base::ThreadChecker thread_checker_; 53 base::ThreadChecker thread_checker_;
40 scoped_refptr<media::cast::CastEnvironment> cast_environment_; 54 scoped_refptr<media::cast::CastEnvironment> cast_environment_;
41 scoped_ptr<media::cast::CastSender> cast_sender_; 55 scoped_ptr<media::cast::CastSender> cast_sender_;
56 scoped_ptr<CastSession::SocketFactory> socket_factory_;
57 net::IPEndPoint remote_address_;
58 scoped_refptr<content::P2PSocketClient> socket_;
42 59
43 // Utilities threads owned by this class. They are used by CastSender for 60 // Utilities threads owned by this class. They are used by CastSender for
44 // encoding. 61 // encoding.
45 base::Thread audio_encode_thread_; 62 base::Thread audio_encode_thread_;
46 base::Thread video_encode_thread_; 63 base::Thread video_encode_thread_;
47 64
48 // Clock used by CastSender. 65 // Clock used by CastSender.
49 base::DefaultTickClock clock_; 66 base::DefaultTickClock clock_;
50 67
51 // Proxy to the IO message loop. 68 // Proxy to the IO message loop.
52 const scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; 69 const scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
53 70
54 DISALLOW_COPY_AND_ASSIGN(CastSessionDelegate); 71 DISALLOW_COPY_AND_ASSIGN(CastSessionDelegate);
55 }; 72 };
56 73
57 #endif // CHROME_RENDERER_MEDIA_CAST_SESSION_DELEGATE_H_ 74 #endif // CHROME_RENDERER_MEDIA_CAST_SESSION_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698