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

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

Issue 173713004: Cast: Plumb raw event logs to cast extension, install EncodingEventSubscriber on CastSessionDelegat… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix subscriber leak 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
« no previous file with comments | « chrome/renderer/media/cast_session.cc ('k') | chrome/renderer/media/cast_session_delegate.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_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 <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/threading/thread.h" 12 #include "base/threading/thread.h"
13 #include "base/threading/thread_checker.h" 13 #include "base/threading/thread_checker.h"
14 #include "base/time/default_tick_clock.h" 14 #include "base/time/default_tick_clock.h"
15 #include "media/cast/cast_config.h" 15 #include "media/cast/cast_config.h"
16 #include "media/cast/cast_sender.h" 16 #include "media/cast/cast_sender.h"
17 17
18 namespace base { 18 namespace base {
19 class MessageLoopProxy; 19 class MessageLoopProxy;
20 } // namespace base 20 } // namespace base
21 21
22 namespace media { 22 namespace media {
23 class VideoFrame; 23 class VideoFrame;
24 24
25 namespace cast { 25 namespace cast {
26 class CastEnvironment; 26 class CastEnvironment;
27 class EncodingEventSubscriber;
27 class FrameInput; 28 class FrameInput;
28 29
29 namespace transport { 30 namespace transport {
30 class CastTransportSender; 31 class CastTransportSender;
31 } // namespace transport 32 } // namespace transport
32 } // namespace cast 33 } // namespace cast
33 } // namespace media 34 } // namespace media
34 35
35 // This class hosts CastSender and connects it to audio/video frame input 36 // This class hosts CastSender and connects it to audio/video frame input
36 // and network socket. 37 // and network socket.
37 // This class is created on the render thread and destroyed on the IO 38 // This class is created on the render thread and destroyed on the IO
38 // thread. All methods are accessible only on the IO thread. 39 // thread. All methods are accessible only on the IO thread.
39 class CastSessionDelegate { 40 class CastSessionDelegate {
40 public: 41 public:
41 typedef base::Callback<void(const scoped_refptr<media::cast::FrameInput>&)> 42 typedef base::Callback<void(const scoped_refptr<media::cast::FrameInput>&)>
42 FrameInputAvailableCallback; 43 FrameInputAvailableCallback;
44 typedef base::Callback<void(scoped_ptr<std::string>)> EventLogsCallback;
43 45
44 CastSessionDelegate(); 46 CastSessionDelegate();
45 virtual ~CastSessionDelegate(); 47 virtual ~CastSessionDelegate();
46 48
47 // After calling StartAudio() or StartVideo() encoding of that media will 49 // After calling StartAudio() or StartVideo() encoding of that media will
48 // begin as soon as data is delivered to its sink, if the second method is 50 // begin as soon as data is delivered to its sink, if the second method is
49 // called the first media will be restarted. It is strongly recommended not to 51 // called the first media will be restarted. It is strongly recommended not to
50 // deliver any data between calling the two methods. 52 // deliver any data between calling the two methods.
51 // It's OK to call only one of the two methods. 53 // It's OK to call only one of the two methods.
52 void StartAudio(const media::cast::AudioSenderConfig& config, 54 void StartAudio(const media::cast::AudioSenderConfig& config,
53 const FrameInputAvailableCallback& callback); 55 const FrameInputAvailableCallback& callback);
54 void StartVideo(const media::cast::VideoSenderConfig& config, 56 void StartVideo(const media::cast::VideoSenderConfig& config,
55 const FrameInputAvailableCallback& callback); 57 const FrameInputAvailableCallback& callback);
56 void StartUDP(const net::IPEndPoint& local_endpoint, 58 void StartUDP(const net::IPEndPoint& local_endpoint,
57 const net::IPEndPoint& remote_endpoint); 59 const net::IPEndPoint& remote_endpoint);
58 60
61 // Returns raw event logs in serialized format since last call.
62 void GetEventLogsAndReset(const EventLogsCallback& callback);
63
59 protected: 64 protected:
60 // Callback with the result of the initialization. 65 // Callback with the result of the initialization.
61 // If this callback is called with STATUS_INITIALIZED it will report back 66 // If this callback is called with STATUS_INITIALIZED it will report back
62 // to the sinks that it's ready to accept incoming audio / video frames. 67 // to the sinks that it's ready to accept incoming audio / video frames.
63 void InitializationResult(media::cast::CastInitializationStatus result) const; 68 void InitializationResult(media::cast::CastInitializationStatus result) const;
64 69
65 private: 70 private:
66 // Start encoding threads and initialize the CastEnvironment. 71 // Start encoding threads and initialize the CastEnvironment.
67 void Initialize(); 72 void Initialize();
68 73
(...skipping 16 matching lines...) Expand all
85 base::Thread audio_encode_thread_; 90 base::Thread audio_encode_thread_;
86 base::Thread video_encode_thread_; 91 base::Thread video_encode_thread_;
87 92
88 // Configuration for audio and video. 93 // Configuration for audio and video.
89 scoped_ptr<media::cast::AudioSenderConfig> audio_config_; 94 scoped_ptr<media::cast::AudioSenderConfig> audio_config_;
90 scoped_ptr<media::cast::VideoSenderConfig> video_config_; 95 scoped_ptr<media::cast::VideoSenderConfig> video_config_;
91 96
92 FrameInputAvailableCallback audio_frame_input_available_callback_; 97 FrameInputAvailableCallback audio_frame_input_available_callback_;
93 FrameInputAvailableCallback video_frame_input_available_callback_; 98 FrameInputAvailableCallback video_frame_input_available_callback_;
94 99
100 scoped_ptr<media::cast::EncodingEventSubscriber> audio_event_subscriber_;
101 scoped_ptr<media::cast::EncodingEventSubscriber> video_event_subscriber_;
102
95 net::IPEndPoint local_endpoint_; 103 net::IPEndPoint local_endpoint_;
96 net::IPEndPoint remote_endpoint_; 104 net::IPEndPoint remote_endpoint_;
97 bool transport_configured_; 105 bool transport_configured_;
98 106
99 // Proxy to the IO message loop. 107 // Proxy to the IO message loop.
100 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; 108 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
101 109
102 DISALLOW_COPY_AND_ASSIGN(CastSessionDelegate); 110 DISALLOW_COPY_AND_ASSIGN(CastSessionDelegate);
103 }; 111 };
104 112
105 #endif // CHROME_RENDERER_MEDIA_CAST_SESSION_DELEGATE_H_ 113 #endif // CHROME_RENDERER_MEDIA_CAST_SESSION_DELEGATE_H_
OLDNEW
« no previous file with comments | « chrome/renderer/media/cast_session.cc ('k') | chrome/renderer/media/cast_session_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698