| 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 <utility> |
| 8 |
| 7 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 8 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| 9 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 10 #include "base/values.h" | 12 #include "base/values.h" |
| 11 #include "media/base/video_frame.h" | 13 #include "media/base/video_frame.h" |
| 12 #include "media/cast/cast_config.h" | 14 #include "media/cast/cast_config.h" |
| 13 #include "media/cast/cast_environment.h" | 15 #include "media/cast/cast_environment.h" |
| 14 #include "media/cast/cast_receiver.h" | 16 #include "media/cast/cast_receiver.h" |
| 15 #include "media/cast/net/cast_transport_config.h" | 17 #include "media/cast/net/cast_transport_config.h" |
| 16 #include "media/cast/net/udp_transport.h" | 18 #include "media/cast/net/udp_transport.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 99 |
| 98 PullNextAudioFrame(); | 100 PullNextAudioFrame(); |
| 99 PullNextVideoFrame(); | 101 PullNextVideoFrame(); |
| 100 } | 102 } |
| 101 | 103 |
| 102 void InProcessReceiver::GotAudioFrame(scoped_ptr<AudioBus> audio_frame, | 104 void InProcessReceiver::GotAudioFrame(scoped_ptr<AudioBus> audio_frame, |
| 103 const base::TimeTicks& playout_time, | 105 const base::TimeTicks& playout_time, |
| 104 bool is_continuous) { | 106 bool is_continuous) { |
| 105 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 107 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
| 106 if (audio_frame.get()) | 108 if (audio_frame.get()) |
| 107 OnAudioFrame(audio_frame.Pass(), playout_time, is_continuous); | 109 OnAudioFrame(std::move(audio_frame), playout_time, is_continuous); |
| 108 PullNextAudioFrame(); | 110 PullNextAudioFrame(); |
| 109 } | 111 } |
| 110 | 112 |
| 111 void InProcessReceiver::GotVideoFrame( | 113 void InProcessReceiver::GotVideoFrame( |
| 112 const scoped_refptr<VideoFrame>& video_frame, | 114 const scoped_refptr<VideoFrame>& video_frame, |
| 113 const base::TimeTicks& playout_time, | 115 const base::TimeTicks& playout_time, |
| 114 bool is_continuous) { | 116 bool is_continuous) { |
| 115 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 117 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
| 116 if (video_frame.get()) | 118 if (video_frame.get()) |
| 117 OnVideoFrame(video_frame, playout_time, is_continuous); | 119 OnVideoFrame(video_frame, playout_time, is_continuous); |
| 118 PullNextVideoFrame(); | 120 PullNextVideoFrame(); |
| 119 } | 121 } |
| 120 | 122 |
| 121 void InProcessReceiver::PullNextAudioFrame() { | 123 void InProcessReceiver::PullNextAudioFrame() { |
| 122 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 124 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
| 123 cast_receiver_->RequestDecodedAudioFrame( | 125 cast_receiver_->RequestDecodedAudioFrame( |
| 124 base::Bind(&InProcessReceiver::GotAudioFrame, | 126 base::Bind(&InProcessReceiver::GotAudioFrame, |
| 125 weak_factory_.GetWeakPtr())); | 127 weak_factory_.GetWeakPtr())); |
| 126 } | 128 } |
| 127 | 129 |
| 128 void InProcessReceiver::PullNextVideoFrame() { | 130 void InProcessReceiver::PullNextVideoFrame() { |
| 129 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 131 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
| 130 cast_receiver_->RequestDecodedVideoFrame(base::Bind( | 132 cast_receiver_->RequestDecodedVideoFrame(base::Bind( |
| 131 &InProcessReceiver::GotVideoFrame, weak_factory_.GetWeakPtr())); | 133 &InProcessReceiver::GotVideoFrame, weak_factory_.GetWeakPtr())); |
| 132 } | 134 } |
| 133 | 135 |
| 134 void InProcessReceiver::ReceivePacket(scoped_ptr<Packet> packet) { | 136 void InProcessReceiver::ReceivePacket(scoped_ptr<Packet> packet) { |
| 135 // TODO(Hubbe): Make an InsertPacket method instead. | 137 // TODO(Hubbe): Make an InsertPacket method instead. |
| 136 cast_receiver_->ReceivePacket(packet.Pass()); | 138 cast_receiver_->ReceivePacket(std::move(packet)); |
| 137 } | 139 } |
| 138 | 140 |
| 139 } // namespace cast | 141 } // namespace cast |
| 140 } // namespace media | 142 } // namespace media |
| OLD | NEW |