| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_BROWSER_MEDIA_CAST_REMOTING_SENDER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_CAST_REMOTING_SENDER_H_ |
| 6 #define CHROME_BROWSER_MEDIA_CAST_REMOTING_SENDER_H_ | 6 #define CHROME_BROWSER_MEDIA_CAST_REMOTING_SENDER_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "media/cast/cast_config.h" | 13 #include "media/cast/cast_config.h" |
| 14 #include "media/cast/net/cast_transport.h" | 14 #include "media/cast/net/cast_transport.h" |
| 15 #include "media/cast/net/rtcp/rtcp_defines.h" | 15 #include "media/cast/net/rtcp/rtcp_defines.h" |
| 16 #include "media/mojo/interfaces/remoting.mojom.h" | 16 #include "media/mojo/interfaces/remoting.mojom.h" |
| 17 #include "mojo/public/cpp/bindings/binding.h" | 17 #include "mojo/public/cpp/bindings/binding.h" |
| 18 #include "mojo/public/cpp/system/watcher.h" | 18 #include "mojo/public/cpp/system/simple_watcher.h" |
| 19 | 19 |
| 20 namespace cast { | 20 namespace cast { |
| 21 | 21 |
| 22 // The callback that is used to send frame events to renderer process for | 22 // The callback that is used to send frame events to renderer process for |
| 23 // logging purpose. | 23 // logging purpose. |
| 24 using FrameEventCallback = | 24 using FrameEventCallback = |
| 25 base::Callback<void(const std::vector<media::cast::FrameEvent>&)>; | 25 base::Callback<void(const std::vector<media::cast::FrameEvent>&)>; |
| 26 | 26 |
| 27 // RTP sender for a single Cast Remoting RTP stream. The client calls Send() to | 27 // RTP sender for a single Cast Remoting RTP stream. The client calls Send() to |
| 28 // instruct the sender to read from a Mojo data pipe and transmit the data using | 28 // instruct the sender to read from a Mojo data pipe and transmit the data using |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 media::cast::RtpTimeTicks frame_rtp_timestamps_[256]; | 189 media::cast::RtpTimeTicks frame_rtp_timestamps_[256]; |
| 190 | 190 |
| 191 // Queue of pending input operations. |input_queue_discards_remaining_| | 191 // Queue of pending input operations. |input_queue_discards_remaining_| |
| 192 // indicates the number of operations where data should be discarded (due to | 192 // indicates the number of operations where data should be discarded (due to |
| 193 // CancelInFlightData()). | 193 // CancelInFlightData()). |
| 194 std::queue<base::Callback<bool(bool)>> input_queue_; | 194 std::queue<base::Callback<bool(bool)>> input_queue_; |
| 195 size_t input_queue_discards_remaining_; | 195 size_t input_queue_discards_remaining_; |
| 196 | 196 |
| 197 // Watches |pipe_| for more data to become available, and then calls | 197 // Watches |pipe_| for more data to become available, and then calls |
| 198 // ProcessInputQueue(). | 198 // ProcessInputQueue(). |
| 199 mojo::Watcher pipe_watcher_; | 199 mojo::SimpleWatcher pipe_watcher_; |
| 200 | 200 |
| 201 // Set to true if the first frame has not yet been sent, or if a | 201 // Set to true if the first frame has not yet been sent, or if a |
| 202 // CancelInFlightData() operation just completed. This causes TrySendFrame() | 202 // CancelInFlightData() operation just completed. This causes TrySendFrame() |
| 203 // to mark the next frame as the start of a new sequence. | 203 // to mark the next frame as the start of a new sequence. |
| 204 bool flow_restart_pending_; | 204 bool flow_restart_pending_; |
| 205 | 205 |
| 206 // FrameEvents pending delivery via |frame_event_cb_|. No event is added if | 206 // FrameEvents pending delivery via |frame_event_cb_|. No event is added if |
| 207 // |frame_event_cb_| is null. | 207 // |frame_event_cb_| is null. |
| 208 std::vector<media::cast::FrameEvent> recent_frame_events_; | 208 std::vector<media::cast::FrameEvent> recent_frame_events_; |
| 209 | 209 |
| 210 // NOTE: Weak pointers must be invalidated before all other member variables. | 210 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 211 base::WeakPtrFactory<CastRemotingSender> weak_factory_; | 211 base::WeakPtrFactory<CastRemotingSender> weak_factory_; |
| 212 | 212 |
| 213 DISALLOW_COPY_AND_ASSIGN(CastRemotingSender); | 213 DISALLOW_COPY_AND_ASSIGN(CastRemotingSender); |
| 214 }; | 214 }; |
| 215 | 215 |
| 216 } // namespace cast | 216 } // namespace cast |
| 217 | 217 |
| 218 #endif // CHROME_BROWSER_MEDIA_CAST_REMOTING_SENDER_H_ | 218 #endif // CHROME_BROWSER_MEDIA_CAST_REMOTING_SENDER_H_ |
| OLD | NEW |