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

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

Issue 170063006: Cast: Add JS API to get raw events logs from cast extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed kalman's comments Created 6 years, 10 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
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"
(...skipping 21 matching lines...) Expand all
32 32
33 class CastSessionDelegate; 33 class CastSessionDelegate;
34 34
35 // This class represents a Cast session and allows the session to be 35 // This class represents a Cast session and allows the session to be
36 // configured on the main thread. Actual work is forwarded to 36 // configured on the main thread. Actual work is forwarded to
37 // CastSessionDelegate on the IO thread. 37 // CastSessionDelegate on the IO thread.
38 class CastSession : public base::RefCounted<CastSession> { 38 class CastSession : public base::RefCounted<CastSession> {
39 public: 39 public:
40 typedef 40 typedef
41 base::Callback<void(const scoped_refptr<media::cast::FrameInput>&)> 41 base::Callback<void(const scoped_refptr<media::cast::FrameInput>&)>
42 FrameInputAvailableCallback; 42 FrameInputAvailableCallback;
43 typedef base::Callback<void(const std::vector<char>&)> SendPacketCallback; 43 typedef base::Callback<void(const std::vector<char>&)> SendPacketCallback;
44 typedef base::Callback<void(scoped_ptr<std::string>)> EventLogsCallback; 44 typedef base::Callback<void(scoped_ptr<std::string>)> EventLogsCallback;
45 45
46 CastSession(); 46 CastSession();
47 47
48 // Start encoding of audio and video using the provided configuration. 48 // Start encoding of audio and video using the provided configuration.
49 // 49 //
50 // When Cast sender is started and ready to be used 50 // When Cast sender is started and ready to be used
51 // media::cast::FrameInput will be given through the callback. The 51 // media::cast::FrameInput will be given through the callback. The
52 // callback will be made on the main thread. 52 // callback will be made on the main thread.
53 void StartAudio(const media::cast::AudioSenderConfig& config, 53 void StartAudio(const media::cast::AudioSenderConfig& config,
54 const FrameInputAvailableCallback& callback); 54 const FrameInputAvailableCallback& callback);
55 void StartVideo(const media::cast::VideoSenderConfig& config, 55 void StartVideo(const media::cast::VideoSenderConfig& config,
56 const FrameInputAvailableCallback& callback); 56 const FrameInputAvailableCallback& callback);
57 void StartUDP(const net::IPEndPoint& local_endpoint, 57 void StartUDP(const net::IPEndPoint& local_endpoint,
58 const net::IPEndPoint& remote_endpoint); 58 const net::IPEndPoint& remote_endpoint);
59 59
60 // Get raw event logs and provide the results in |callback| on main thread. 60 // Creates or destroys event subscriber for the audio or video stream.
61 void GetEventLogsAndReset(const EventLogsCallback& callback); 61 // |enable|: If true, creates an event subscriber. Otherwise destroys
62 // existing subscriber and discards logs.
63 // |is_audio|: true if the event subscriber is for audio. Video otherwise.
64 void ToggleLogging(bool enable, bool is_audio);
Alpha Left Google 2014/02/26 00:53:52 nit: The order of arguments should match GetEventL
imcheng 2014/02/26 01:21:07 Done.
65
66 // Returns raw event logs in serialized format for either the audio or video
67 // stream since last call and returns result in |callback|.
68 void GetEventLogsAndReset(bool is_audio, const EventLogsCallback& callback);
62 69
63 private: 70 private:
64 friend class base::RefCounted<CastSession>; 71 friend class base::RefCounted<CastSession>;
65 virtual ~CastSession(); 72 virtual ~CastSession();
66 73
67 // This member should never be dereferenced on the main thread. 74 // This member should never be dereferenced on the main thread.
68 // CastSessionDelegate lives only on the IO thread. It is always 75 // CastSessionDelegate lives only on the IO thread. It is always
69 // safe to post task on the IO thread to access CastSessionDelegate 76 // safe to post task on the IO thread to access CastSessionDelegate
70 // because it is owned by this object. 77 // because it is owned by this object.
71 scoped_ptr<CastSessionDelegate> delegate_; 78 scoped_ptr<CastSessionDelegate> delegate_;
72 79
73 // Proxy to the IO message loop. 80 // Proxy to the IO message loop.
74 const scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; 81 const scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
75 82
76 DISALLOW_COPY_AND_ASSIGN(CastSession); 83 DISALLOW_COPY_AND_ASSIGN(CastSession);
77 }; 84 };
78 85
79 #endif // CHROME_RENDERER_MEDIA_CAST_SESSION_H_ 86 #endif // CHROME_RENDERER_MEDIA_CAST_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698