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

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

Issue 163553006: Cast: Refactoring Cast API's (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 9 months 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
« no previous file with comments | « chrome/renderer/media/cast_rtp_stream.cc ('k') | chrome/renderer/media/cast_session.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "net/base/ip_endpoint.h" 14 #include "net/base/ip_endpoint.h"
15 15
16 namespace base { 16 namespace base {
17 class DictionaryValue; 17 class DictionaryValue;
18 class MessageLoopProxy; 18 class MessageLoopProxy;
19 } // namespace base 19 } // namespace base
20 20
21 namespace media { 21 namespace media {
22 class VideoFrame; 22 class VideoFrame;
23 namespace cast { 23 namespace cast {
24 class FrameInput; 24 class AudioFrameInput;
25 class VideoFrameInput;
25 struct AudioSenderConfig; 26 struct AudioSenderConfig;
26 struct VideoSenderConfig; 27 struct VideoSenderConfig;
27 } // namespace cast 28 } // namespace cast
28 } // namespace media 29 } // namespace media
29 30
30 namespace content { 31 namespace content {
31 class P2PSocketClient; 32 class P2PSocketClient;
32 } // namespace content 33 } // namespace content
33 34
34 class CastSessionDelegate; 35 class CastSessionDelegate;
35 36
36 // This class represents a Cast session and allows the session to be 37 // This class represents a Cast session and allows the session to be
37 // configured on the main thread. Actual work is forwarded to 38 // configured on the main thread. Actual work is forwarded to
38 // CastSessionDelegate on the IO thread. 39 // CastSessionDelegate on the IO thread.
39 class CastSession : public base::RefCounted<CastSession> { 40 class CastSession : public base::RefCounted<CastSession> {
40 public: 41 public:
41 typedef 42 typedef base::Callback<void(const scoped_refptr<
42 base::Callback<void(const scoped_refptr<media::cast::FrameInput>&)> 43 media::cast::AudioFrameInput>&)> AudioFrameInputAvailableCallback;
43 FrameInputAvailableCallback; 44 typedef base::Callback<void(const scoped_refptr<
45 media::cast::VideoFrameInput>&)> VideoFrameInputAvailableCallback;
44 typedef base::Callback<void(const std::vector<char>&)> SendPacketCallback; 46 typedef base::Callback<void(const std::vector<char>&)> SendPacketCallback;
45 typedef base::Callback<void(scoped_ptr<std::string>)> EventLogsCallback; 47 typedef base::Callback<void(scoped_ptr<std::string>)> EventLogsCallback;
46 typedef base::Callback<void(scoped_ptr<base::DictionaryValue>)> StatsCallback; 48 typedef base::Callback<void(scoped_ptr<base::DictionaryValue>)> StatsCallback;
47 49
48 CastSession(); 50 CastSession();
49 51
50 // Start encoding of audio and video using the provided configuration. 52 // Start encoding of audio and video using the provided configuration.
51 // 53 //
52 // When Cast sender is started and ready to be used 54 // When Cast sender is started and ready to be used
53 // media::cast::FrameInput will be given through the callback. The 55 // media::cast::FrameInput will be given through the callback. The
54 // callback will be made on the main thread. 56 // callback will be made on the main thread.
55 void StartAudio(const media::cast::AudioSenderConfig& config, 57 void StartAudio(const media::cast::AudioSenderConfig& config,
56 const FrameInputAvailableCallback& callback); 58 const AudioFrameInputAvailableCallback& callback);
57 void StartVideo(const media::cast::VideoSenderConfig& config, 59 void StartVideo(const media::cast::VideoSenderConfig& config,
58 const FrameInputAvailableCallback& callback); 60 const VideoFrameInputAvailableCallback& callback);
59 void StartUDP(const net::IPEndPoint& local_endpoint, 61 void StartUDP(const net::IPEndPoint& local_endpoint,
60 const net::IPEndPoint& remote_endpoint); 62 const net::IPEndPoint& remote_endpoint);
61 63
62 // Creates or destroys event subscriber for the audio or video stream. 64 // Creates or destroys event subscriber for the audio or video stream.
63 // |is_audio|: true if the event subscriber is for audio. Video otherwise. 65 // |is_audio|: true if the event subscriber is for audio. Video otherwise.
64 // |enable|: If true, creates an event subscriber. Otherwise destroys 66 // |enable|: If true, creates an event subscriber. Otherwise destroys
65 // existing subscriber and discards logs. 67 // existing subscriber and discards logs.
66 void ToggleLogging(bool is_audio, bool enable); 68 void ToggleLogging(bool is_audio, bool enable);
67 69
68 // Returns raw event logs in serialized format for either the audio or video 70 // Returns raw event logs in serialized format for either the audio or video
(...skipping 14 matching lines...) Expand all
83 // because it is owned by this object. 85 // because it is owned by this object.
84 scoped_ptr<CastSessionDelegate> delegate_; 86 scoped_ptr<CastSessionDelegate> delegate_;
85 87
86 // Proxy to the IO message loop. 88 // Proxy to the IO message loop.
87 const scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; 89 const scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
88 90
89 DISALLOW_COPY_AND_ASSIGN(CastSession); 91 DISALLOW_COPY_AND_ASSIGN(CastSession);
90 }; 92 };
91 93
92 #endif // CHROME_RENDERER_MEDIA_CAST_SESSION_H_ 94 #endif // CHROME_RENDERER_MEDIA_CAST_SESSION_H_
OLDNEW
« no previous file with comments | « chrome/renderer/media/cast_rtp_stream.cc ('k') | chrome/renderer/media/cast_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698