| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 MEDIA_CAST_TEST_IN_PROCESS_RECEIVER_H_ | 5 #ifndef MEDIA_CAST_TEST_IN_PROCESS_RECEIVER_H_ |
| 6 #define MEDIA_CAST_TEST_IN_PROCESS_RECEIVER_H_ | 6 #define MEDIA_CAST_TEST_IN_PROCESS_RECEIVER_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "media/base/audio_bus.h" |
| 11 #include "media/cast/cast_config.h" | 12 #include "media/cast/cast_config.h" |
| 12 #include "media/cast/transport/cast_transport_config.h" | 13 #include "media/cast/transport/cast_transport_config.h" |
| 13 | 14 |
| 14 namespace base { | 15 namespace base { |
| 15 class TimeTicks; | 16 class TimeTicks; |
| 16 } // namespace base | 17 } // namespace base |
| 17 | 18 |
| 18 namespace net { | 19 namespace net { |
| 19 class IPEndPoint; | 20 class IPEndPoint; |
| 20 } // namespace net | 21 } // namespace net |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 virtual void StartOnMainThread(); | 76 virtual void StartOnMainThread(); |
| 76 | 77 |
| 77 // Callback for the transport to notify of status changes. A default | 78 // Callback for the transport to notify of status changes. A default |
| 78 // implementation is provided here that simply logs socket errors. | 79 // implementation is provided here that simply logs socket errors. |
| 79 virtual void UpdateCastTransportStatus(transport::CastTransportStatus status); | 80 virtual void UpdateCastTransportStatus(transport::CastTransportStatus status); |
| 80 | 81 |
| 81 private: | 82 private: |
| 82 friend class base::RefCountedThreadSafe<InProcessReceiver>; | 83 friend class base::RefCountedThreadSafe<InProcessReceiver>; |
| 83 | 84 |
| 84 // CastReceiver callbacks that receive a frame and then request another. | 85 // CastReceiver callbacks that receive a frame and then request another. |
| 85 void GotAudioFrame(scoped_ptr<PcmAudioFrame> audio_frame, | 86 void GotAudioFrame(scoped_ptr<AudioBus> audio_frame, |
| 86 const base::TimeTicks& playout_time); | 87 const base::TimeTicks& playout_time, |
| 88 bool is_continuous); |
| 87 void GotVideoFrame(const scoped_refptr<VideoFrame>& video_frame, | 89 void GotVideoFrame(const scoped_refptr<VideoFrame>& video_frame, |
| 88 const base::TimeTicks& render_time); | 90 const base::TimeTicks& render_time); |
| 89 void PullNextAudioFrame(); | 91 void PullNextAudioFrame(); |
| 90 void PullNextVideoFrame(); | 92 void PullNextVideoFrame(); |
| 91 | 93 |
| 92 // Invoked just before the destruction of |receiver| on the cast MAIN thread. | 94 // Invoked just before the destruction of |receiver| on the cast MAIN thread. |
| 93 static void WillDestroyReceiver(InProcessReceiver* receiver); | 95 static void WillDestroyReceiver(InProcessReceiver* receiver); |
| 94 | 96 |
| 95 const scoped_refptr<CastEnvironment> cast_environment_; | 97 const scoped_refptr<CastEnvironment> cast_environment_; |
| 96 const net::IPEndPoint local_end_point_; | 98 const net::IPEndPoint local_end_point_; |
| 97 const net::IPEndPoint remote_end_point_; | 99 const net::IPEndPoint remote_end_point_; |
| 98 const AudioReceiverConfig audio_config_; | 100 const AudioReceiverConfig audio_config_; |
| 99 const VideoReceiverConfig video_config_; | 101 const VideoReceiverConfig video_config_; |
| 100 | 102 |
| 101 scoped_ptr<transport::UdpTransport> transport_; | 103 scoped_ptr<transport::UdpTransport> transport_; |
| 102 scoped_ptr<CastReceiver> cast_receiver_; | 104 scoped_ptr<CastReceiver> cast_receiver_; |
| 103 | 105 |
| 104 // NOTE: Weak pointers must be invalidated before all other member variables. | 106 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 105 base::WeakPtrFactory<InProcessReceiver> weak_factory_; | 107 base::WeakPtrFactory<InProcessReceiver> weak_factory_; |
| 106 | 108 |
| 107 DISALLOW_COPY_AND_ASSIGN(InProcessReceiver); | 109 DISALLOW_COPY_AND_ASSIGN(InProcessReceiver); |
| 108 }; | 110 }; |
| 109 | 111 |
| 110 } // namespace cast | 112 } // namespace cast |
| 111 } // namespace media | 113 } // namespace media |
| 112 | 114 |
| 113 #endif // MEDIA_CAST_TEST_IN_PROCESS_RECEIVER_H_ | 115 #endif // MEDIA_CAST_TEST_IN_PROCESS_RECEIVER_H_ |
| OLD | NEW |