| 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" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 const base::TimeTicks& playout_time, | 104 const base::TimeTicks& playout_time, |
| 105 bool is_continuous) { | 105 bool is_continuous) { |
| 106 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 106 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
| 107 if (audio_frame.get()) | 107 if (audio_frame.get()) |
| 108 OnAudioFrame(audio_frame.Pass(), playout_time, is_continuous); | 108 OnAudioFrame(audio_frame.Pass(), playout_time, is_continuous); |
| 109 PullNextAudioFrame(); | 109 PullNextAudioFrame(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void InProcessReceiver::GotVideoFrame( | 112 void InProcessReceiver::GotVideoFrame( |
| 113 const scoped_refptr<VideoFrame>& video_frame, | 113 const scoped_refptr<VideoFrame>& video_frame, |
| 114 const base::TimeTicks& render_time) { | 114 const base::TimeTicks& playout_time, |
| 115 bool is_continuous) { |
| 115 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 116 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
| 116 OnVideoFrame(video_frame, render_time, true /* pending CL to set this */); | 117 if (video_frame) |
| 118 OnVideoFrame(video_frame, playout_time, is_continuous); |
| 117 PullNextVideoFrame(); | 119 PullNextVideoFrame(); |
| 118 } | 120 } |
| 119 | 121 |
| 120 void InProcessReceiver::PullNextAudioFrame() { | 122 void InProcessReceiver::PullNextAudioFrame() { |
| 121 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 123 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
| 122 cast_receiver_->frame_receiver()->GetRawAudioFrame( | 124 cast_receiver_->frame_receiver()->GetRawAudioFrame( |
| 123 base::Bind(&InProcessReceiver::GotAudioFrame, | 125 base::Bind(&InProcessReceiver::GotAudioFrame, |
| 124 weak_factory_.GetWeakPtr())); | 126 weak_factory_.GetWeakPtr())); |
| 125 } | 127 } |
| 126 | 128 |
| 127 void InProcessReceiver::PullNextVideoFrame() { | 129 void InProcessReceiver::PullNextVideoFrame() { |
| 128 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 130 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
| 129 cast_receiver_->frame_receiver()->GetRawVideoFrame(base::Bind( | 131 cast_receiver_->frame_receiver()->GetRawVideoFrame(base::Bind( |
| 130 &InProcessReceiver::GotVideoFrame, weak_factory_.GetWeakPtr())); | 132 &InProcessReceiver::GotVideoFrame, weak_factory_.GetWeakPtr())); |
| 131 } | 133 } |
| 132 | 134 |
| 133 // static | 135 // static |
| 134 void InProcessReceiver::WillDestroyReceiver(InProcessReceiver* receiver) { | 136 void InProcessReceiver::WillDestroyReceiver(InProcessReceiver* receiver) { |
| 135 DCHECK(receiver->cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 137 DCHECK(receiver->cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
| 136 } | 138 } |
| 137 | 139 |
| 138 } // namespace cast | 140 } // namespace cast |
| 139 } // namespace media | 141 } // namespace media |
| OLD | NEW |