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

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

Issue 184853003: Cast: Add GetStats() extensions API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: static cast to int 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
« 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 MessageLoopProxy; 18 class MessageLoopProxy;
18 } // namespace base 19 } // namespace base
19 20
20 namespace media { 21 namespace media {
21 class VideoFrame; 22 class VideoFrame;
22 namespace cast { 23 namespace cast {
23 class FrameInput; 24 class FrameInput;
24 struct AudioSenderConfig; 25 struct AudioSenderConfig;
25 struct VideoSenderConfig; 26 struct VideoSenderConfig;
26 } // namespace cast 27 } // namespace cast
27 } // namespace media 28 } // namespace media
28 29
29 namespace content { 30 namespace content {
30 class P2PSocketClient; 31 class P2PSocketClient;
31 } // namespace content 32 } // namespace content
32 33
33 class CastSessionDelegate; 34 class CastSessionDelegate;
34 35
35 // This class represents a Cast session and allows the session to be 36 // This class represents a Cast session and allows the session to be
36 // configured on the main thread. Actual work is forwarded to 37 // configured on the main thread. Actual work is forwarded to
37 // CastSessionDelegate on the IO thread. 38 // CastSessionDelegate on the IO thread.
38 class CastSession : public base::RefCounted<CastSession> { 39 class CastSession : public base::RefCounted<CastSession> {
39 public: 40 public:
40 typedef 41 typedef
41 base::Callback<void(const scoped_refptr<media::cast::FrameInput>&)> 42 base::Callback<void(const scoped_refptr<media::cast::FrameInput>&)>
42 FrameInputAvailableCallback; 43 FrameInputAvailableCallback;
43 typedef base::Callback<void(const std::vector<char>&)> SendPacketCallback; 44 typedef base::Callback<void(const std::vector<char>&)> SendPacketCallback;
44 typedef base::Callback<void(scoped_ptr<std::string>)> EventLogsCallback; 45 typedef base::Callback<void(scoped_ptr<std::string>)> EventLogsCallback;
46 typedef base::Callback<void(scoped_ptr<base::DictionaryValue>)> StatsCallback;
45 47
46 CastSession(); 48 CastSession();
47 49
48 // Start encoding of audio and video using the provided configuration. 50 // Start encoding of audio and video using the provided configuration.
49 // 51 //
50 // When Cast sender is started and ready to be used 52 // When Cast sender is started and ready to be used
51 // media::cast::FrameInput will be given through the callback. The 53 // media::cast::FrameInput will be given through the callback. The
52 // callback will be made on the main thread. 54 // callback will be made on the main thread.
53 void StartAudio(const media::cast::AudioSenderConfig& config, 55 void StartAudio(const media::cast::AudioSenderConfig& config,
54 const FrameInputAvailableCallback& callback); 56 const FrameInputAvailableCallback& callback);
55 void StartVideo(const media::cast::VideoSenderConfig& config, 57 void StartVideo(const media::cast::VideoSenderConfig& config,
56 const FrameInputAvailableCallback& callback); 58 const FrameInputAvailableCallback& callback);
57 void StartUDP(const net::IPEndPoint& local_endpoint, 59 void StartUDP(const net::IPEndPoint& local_endpoint,
58 const net::IPEndPoint& remote_endpoint); 60 const net::IPEndPoint& remote_endpoint);
59 61
60 // Creates or destroys event subscriber for the audio or video stream. 62 // Creates or destroys event subscriber for the audio or video stream.
61 // |is_audio|: true if the event subscriber is for audio. Video otherwise. 63 // |is_audio|: true if the event subscriber is for audio. Video otherwise.
62 // |enable|: If true, creates an event subscriber. Otherwise destroys 64 // |enable|: If true, creates an event subscriber. Otherwise destroys
63 // existing subscriber and discards logs. 65 // existing subscriber and discards logs.
64 void ToggleLogging(bool is_audio, bool enable); 66 void ToggleLogging(bool is_audio, bool enable);
65 67
66 // Returns raw event logs in serialized format for either the audio or video 68 // Returns raw event logs in serialized format for either the audio or video
67 // stream since last call and returns result in |callback|. 69 // stream since last call and returns result in |callback|.
68 void GetEventLogsAndReset(bool is_audio, const EventLogsCallback& callback); 70 void GetEventLogsAndReset(bool is_audio, const EventLogsCallback& callback);
69 71
72 // Returns stats in a DictionaryValue format for either the audio or video
73 // stream since last call and returns result in |callback|.
74 void GetStatsAndReset(bool is_audio, const StatsCallback& callback);
75
70 private: 76 private:
71 friend class base::RefCounted<CastSession>; 77 friend class base::RefCounted<CastSession>;
72 virtual ~CastSession(); 78 virtual ~CastSession();
73 79
74 // This member should never be dereferenced on the main thread. 80 // This member should never be dereferenced on the main thread.
75 // CastSessionDelegate lives only on the IO thread. It is always 81 // CastSessionDelegate lives only on the IO thread. It is always
76 // safe to post task on the IO thread to access CastSessionDelegate 82 // safe to post task on the IO thread to access CastSessionDelegate
77 // because it is owned by this object. 83 // because it is owned by this object.
78 scoped_ptr<CastSessionDelegate> delegate_; 84 scoped_ptr<CastSessionDelegate> delegate_;
79 85
80 // Proxy to the IO message loop. 86 // Proxy to the IO message loop.
81 const scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; 87 const scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
82 88
83 DISALLOW_COPY_AND_ASSIGN(CastSession); 89 DISALLOW_COPY_AND_ASSIGN(CastSession);
84 }; 90 };
85 91
86 #endif // CHROME_RENDERER_MEDIA_CAST_SESSION_H_ 92 #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