| 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 #include "media/cast/test/utility/in_process_receiver.h" | 5 #include "media/cast/test/utility/in_process_receiver.h" |
| 6 | 6 |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "media/base/video_frame.h" | 10 #include "media/base/video_frame.h" |
| 11 #include "media/cast/cast_config.h" | 11 #include "media/cast/cast_config.h" |
| 12 #include "media/cast/cast_environment.h" | 12 #include "media/cast/cast_environment.h" |
| 13 #include "media/cast/cast_receiver.h" | 13 #include "media/cast/cast_receiver.h" |
| 14 #include "media/cast/transport/cast_transport_config.h" | 14 #include "media/cast/net/cast_transport_config.h" |
| 15 #include "media/cast/transport/transport/udp_transport.h" | 15 #include "media/cast/net/udp_transport.h" |
| 16 | 16 |
| 17 using media::cast::transport::CastTransportStatus; | 17 using media::cast::CastTransportStatus; |
| 18 using media::cast::transport::UdpTransport; | 18 using media::cast::UdpTransport; |
| 19 | 19 |
| 20 namespace media { | 20 namespace media { |
| 21 namespace cast { | 21 namespace cast { |
| 22 | 22 |
| 23 InProcessReceiver::InProcessReceiver( | 23 InProcessReceiver::InProcessReceiver( |
| 24 const scoped_refptr<CastEnvironment>& cast_environment, | 24 const scoped_refptr<CastEnvironment>& cast_environment, |
| 25 const net::IPEndPoint& local_end_point, | 25 const net::IPEndPoint& local_end_point, |
| 26 const net::IPEndPoint& remote_end_point, | 26 const net::IPEndPoint& remote_end_point, |
| 27 const FrameReceiverConfig& audio_config, | 27 const FrameReceiverConfig& audio_config, |
| 28 const FrameReceiverConfig& video_config) | 28 const FrameReceiverConfig& video_config) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 void InProcessReceiver::StopOnMainThread(base::WaitableEvent* event) { | 61 void InProcessReceiver::StopOnMainThread(base::WaitableEvent* event) { |
| 62 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 62 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
| 63 cast_receiver_.reset(NULL); | 63 cast_receiver_.reset(NULL); |
| 64 transport_.reset(NULL); | 64 transport_.reset(NULL); |
| 65 weak_factory_.InvalidateWeakPtrs(); | 65 weak_factory_.InvalidateWeakPtrs(); |
| 66 event->Signal(); | 66 event->Signal(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void InProcessReceiver::UpdateCastTransportStatus(CastTransportStatus status) { | 69 void InProcessReceiver::UpdateCastTransportStatus(CastTransportStatus status) { |
| 70 LOG_IF(ERROR, status == media::cast::transport::TRANSPORT_SOCKET_ERROR) | 70 LOG_IF(ERROR, status == media::cast::TRANSPORT_SOCKET_ERROR) |
| 71 << "Transport socket error occurred. InProcessReceiver is likely dead."; | 71 << "Transport socket error occurred. InProcessReceiver is likely dead."; |
| 72 VLOG(1) << "CastTransportStatus is now " << status; | 72 VLOG(1) << "CastTransportStatus is now " << status; |
| 73 } | 73 } |
| 74 | 74 |
| 75 void InProcessReceiver::StartOnMainThread() { | 75 void InProcessReceiver::StartOnMainThread() { |
| 76 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 76 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
| 77 | 77 |
| 78 DCHECK(!transport_ && !cast_receiver_); | 78 DCHECK(!transport_ && !cast_receiver_); |
| 79 transport_.reset( | 79 transport_.reset( |
| 80 new UdpTransport(NULL, | 80 new UdpTransport(NULL, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } | 120 } |
| 121 | 121 |
| 122 void InProcessReceiver::PullNextVideoFrame() { | 122 void InProcessReceiver::PullNextVideoFrame() { |
| 123 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 123 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
| 124 cast_receiver_->RequestDecodedVideoFrame(base::Bind( | 124 cast_receiver_->RequestDecodedVideoFrame(base::Bind( |
| 125 &InProcessReceiver::GotVideoFrame, weak_factory_.GetWeakPtr())); | 125 &InProcessReceiver::GotVideoFrame, weak_factory_.GetWeakPtr())); |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace cast | 128 } // namespace cast |
| 129 } // namespace media | 129 } // namespace media |
| OLD | NEW |