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

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

Issue 938903003: Cast: Javascript bindings for cast receiver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cast_receiver_session
Patch Set: comments addressed Created 5 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_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 <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 25 matching lines...) Expand all
36 namespace transport { 36 namespace transport {
37 class CastTransportSender; 37 class CastTransportSender;
38 } // namespace transport 38 } // namespace transport
39 } // namespace cast 39 } // namespace cast
40 } // namespace media 40 } // namespace media
41 41
42 // Breaks out functionality that is common between CastSessionDelegate and 42 // Breaks out functionality that is common between CastSessionDelegate and
43 // CastReceiverSessionDelegate. 43 // CastReceiverSessionDelegate.
44 class CastSessionDelegateBase { 44 class CastSessionDelegateBase {
45 public: 45 public:
46 typedef base::Callback<void(const std::string&)> ErrorCallback;
47
46 CastSessionDelegateBase(); 48 CastSessionDelegateBase();
47 virtual ~CastSessionDelegateBase(); 49 virtual ~CastSessionDelegateBase();
48 50
49 // This will start the session by configuring and creating the Cast transport 51 // This will start the session by configuring and creating the Cast transport
50 // and the Cast sender. 52 // and the Cast sender.
51 // Must be called before initialization of audio or video. 53 // Must be called before initialization of audio or video.
52 void StartUDP(const net::IPEndPoint& local_endpoint, 54 void StartUDP(const net::IPEndPoint& local_endpoint,
53 const net::IPEndPoint& remote_endpoint, 55 const net::IPEndPoint& remote_endpoint,
54 scoped_ptr<base::DictionaryValue> options); 56 scoped_ptr<base::DictionaryValue> options,
57 const ErrorCallback& error_callback);
55 58
56 protected: 59 protected:
57 void StatusNotificationCB( 60 void StatusNotificationCB(
61 const ErrorCallback& error_callback,
58 media::cast::CastTransportStatus status); 62 media::cast::CastTransportStatus status);
59 63
60 virtual void ReceivePacket(scoped_ptr<media::cast::Packet> packet) = 0; 64 virtual void ReceivePacket(scoped_ptr<media::cast::Packet> packet) = 0;
61 virtual void LogRawEvents( 65 virtual void LogRawEvents(
62 const std::vector<media::cast::PacketEvent>& packet_events, 66 const std::vector<media::cast::PacketEvent>& packet_events,
63 const std::vector<media::cast::FrameEvent>& frame_events) = 0; 67 const std::vector<media::cast::FrameEvent>& frame_events) = 0;
64 68
65 base::ThreadChecker thread_checker_; 69 base::ThreadChecker thread_checker_;
66 scoped_refptr<media::cast::CastEnvironment> cast_environment_; 70 scoped_refptr<media::cast::CastEnvironment> cast_environment_;
67 scoped_ptr<media::cast::CastTransportSender> cast_transport_; 71 scoped_ptr<media::cast::CastTransportSender> cast_transport_;
(...skipping 10 matching lines...) Expand all
78 // This class is created on the render thread and destroyed on the IO 82 // This class is created on the render thread and destroyed on the IO
79 // thread. All methods are accessible only on the IO thread. 83 // thread. All methods are accessible only on the IO thread.
80 class CastSessionDelegate : public CastSessionDelegateBase { 84 class CastSessionDelegate : public CastSessionDelegateBase {
81 public: 85 public:
82 typedef base::Callback<void(const scoped_refptr< 86 typedef base::Callback<void(const scoped_refptr<
83 media::cast::AudioFrameInput>&)> AudioFrameInputAvailableCallback; 87 media::cast::AudioFrameInput>&)> AudioFrameInputAvailableCallback;
84 typedef base::Callback<void(const scoped_refptr< 88 typedef base::Callback<void(const scoped_refptr<
85 media::cast::VideoFrameInput>&)> VideoFrameInputAvailableCallback; 89 media::cast::VideoFrameInput>&)> VideoFrameInputAvailableCallback;
86 typedef base::Callback<void(scoped_ptr<base::BinaryValue>)> EventLogsCallback; 90 typedef base::Callback<void(scoped_ptr<base::BinaryValue>)> EventLogsCallback;
87 typedef base::Callback<void(scoped_ptr<base::DictionaryValue>)> StatsCallback; 91 typedef base::Callback<void(scoped_ptr<base::DictionaryValue>)> StatsCallback;
88 typedef base::Callback<void(const std::string&)> ErrorCallback;
89 92
90 CastSessionDelegate(); 93 CastSessionDelegate();
91 ~CastSessionDelegate() override; 94 ~CastSessionDelegate() override;
92 95
93 void StartUDP(const net::IPEndPoint& local_endpoint, 96 void StartUDP(const net::IPEndPoint& local_endpoint,
94 const net::IPEndPoint& remote_endpoint, 97 const net::IPEndPoint& remote_endpoint,
95 scoped_ptr<base::DictionaryValue> options); 98 scoped_ptr<base::DictionaryValue> options,
99 const ErrorCallback& error_callback);
96 100
97 // After calling StartAudio() or StartVideo() encoding of that media will 101 // After calling StartAudio() or StartVideo() encoding of that media will
98 // begin as soon as data is delivered to its sink, if the second method is 102 // begin as soon as data is delivered to its sink, if the second method is
99 // called the first media will be restarted. It is strongly recommended not to 103 // called the first media will be restarted. It is strongly recommended not to
100 // deliver any data between calling the two methods. 104 // deliver any data between calling the two methods.
101 // It's OK to call only one of the two methods. 105 // It's OK to call only one of the two methods.
102 // StartUDP must be called before these methods. 106 // StartUDP must be called before these methods.
103 void StartAudio(const media::cast::AudioSenderConfig& config, 107 void StartAudio(const media::cast::AudioSenderConfig& config,
104 const AudioFrameInputAvailableCallback& callback, 108 const AudioFrameInputAvailableCallback& callback,
105 const ErrorCallback& error_callback); 109 const ErrorCallback& error_callback);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 VideoFrameInputAvailableCallback video_frame_input_available_callback_; 147 VideoFrameInputAvailableCallback video_frame_input_available_callback_;
144 148
145 scoped_ptr<media::cast::RawEventSubscriberBundle> event_subscribers_; 149 scoped_ptr<media::cast::RawEventSubscriberBundle> event_subscribers_;
146 150
147 base::WeakPtrFactory<CastSessionDelegate> weak_factory_; 151 base::WeakPtrFactory<CastSessionDelegate> weak_factory_;
148 152
149 DISALLOW_COPY_AND_ASSIGN(CastSessionDelegate); 153 DISALLOW_COPY_AND_ASSIGN(CastSessionDelegate);
150 }; 154 };
151 155
152 #endif // CHROME_RENDERER_MEDIA_CAST_SESSION_DELEGATE_H_ 156 #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