Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(966)

Side by Side Diff: media/cast/test/utility/in_process_receiver.cc

Issue 225023010: [Cast] Refactor/clean-up VideoReceiver to match AudioReceiver as closely as possible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 pcm_frame->samples.resize(audio_frame->channels() * audio_frame->frames()); 113 pcm_frame->samples.resize(audio_frame->channels() * audio_frame->frames());
114 audio_frame->ToInterleaved( 114 audio_frame->ToInterleaved(
115 audio_frame->frames(), sizeof(int16), &pcm_frame->samples.front()); 115 audio_frame->frames(), sizeof(int16), &pcm_frame->samples.front());
116 OnAudioFrame(pcm_frame.Pass(), playout_time); 116 OnAudioFrame(pcm_frame.Pass(), playout_time);
117 } 117 }
118 PullNextAudioFrame(); 118 PullNextAudioFrame();
119 } 119 }
120 120
121 void InProcessReceiver::GotVideoFrame( 121 void InProcessReceiver::GotVideoFrame(
122 const scoped_refptr<VideoFrame>& video_frame, 122 const scoped_refptr<VideoFrame>& video_frame,
123 const base::TimeTicks& render_time) { 123 const base::TimeTicks& playout_time,
124 bool is_continuous) {
124 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 125 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
125 OnVideoFrame(video_frame, render_time); 126 if (video_frame) {
127 // TODO(miu): Pass |is_continuous| flag.
128 OnVideoFrame(video_frame, playout_time);
129 }
126 PullNextVideoFrame(); 130 PullNextVideoFrame();
127 } 131 }
128 132
129 void InProcessReceiver::PullNextAudioFrame() { 133 void InProcessReceiver::PullNextAudioFrame() {
130 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 134 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
131 cast_receiver_->frame_receiver()->GetRawAudioFrame( 135 cast_receiver_->frame_receiver()->GetRawAudioFrame(
132 base::Bind(&InProcessReceiver::GotAudioFrame, 136 base::Bind(&InProcessReceiver::GotAudioFrame,
133 weak_factory_.GetWeakPtr())); 137 weak_factory_.GetWeakPtr()));
134 } 138 }
135 139
136 void InProcessReceiver::PullNextVideoFrame() { 140 void InProcessReceiver::PullNextVideoFrame() {
137 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 141 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
138 cast_receiver_->frame_receiver()->GetRawVideoFrame(base::Bind( 142 cast_receiver_->frame_receiver()->GetRawVideoFrame(base::Bind(
139 &InProcessReceiver::GotVideoFrame, weak_factory_.GetWeakPtr())); 143 &InProcessReceiver::GotVideoFrame, weak_factory_.GetWeakPtr()));
140 } 144 }
141 145
142 // static 146 // static
143 void InProcessReceiver::WillDestroyReceiver(InProcessReceiver* receiver) { 147 void InProcessReceiver::WillDestroyReceiver(InProcessReceiver* receiver) {
144 DCHECK(receiver->cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 148 DCHECK(receiver->cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
145 } 149 }
146 150
147 } // namespace cast 151 } // namespace cast
148 } // namespace media 152 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698