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

Side by Side Diff: media/cast/receiver/frame_receiver.cc

Issue 388663003: Cast: Reshuffle files under media/cast (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: missing includes Created 6 years, 5 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
« no previous file with comments | « media/cast/receiver/frame_receiver.h ('k') | media/cast/receiver/frame_receiver_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/receiver/frame_receiver.h" 5 #include "media/cast/receiver/frame_receiver.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/big_endian.h" 9 #include "base/big_endian.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "media/cast/cast_environment.h" 13 #include "media/cast/cast_environment.h"
14 14
15 namespace { 15 namespace {
16 const int kMinSchedulingDelayMs = 1; 16 const int kMinSchedulingDelayMs = 1;
17 } // namespace 17 } // namespace
18 18
19 namespace media { 19 namespace media {
20 namespace cast { 20 namespace cast {
21 21
22 FrameReceiver::FrameReceiver( 22 FrameReceiver::FrameReceiver(
23 const scoped_refptr<CastEnvironment>& cast_environment, 23 const scoped_refptr<CastEnvironment>& cast_environment,
24 const FrameReceiverConfig& config, 24 const FrameReceiverConfig& config,
25 EventMediaType event_media_type, 25 EventMediaType event_media_type,
26 transport::PacedPacketSender* const packet_sender) 26 PacedPacketSender* const packet_sender)
27 : cast_environment_(cast_environment), 27 : cast_environment_(cast_environment),
28 packet_parser_(config.incoming_ssrc, config.rtp_payload_type), 28 packet_parser_(config.incoming_ssrc, config.rtp_payload_type),
29 stats_(cast_environment->Clock()), 29 stats_(cast_environment->Clock()),
30 event_media_type_(event_media_type), 30 event_media_type_(event_media_type),
31 event_subscriber_(kReceiverRtcpEventHistorySize, event_media_type), 31 event_subscriber_(kReceiverRtcpEventHistorySize, event_media_type),
32 rtp_timebase_(config.frequency), 32 rtp_timebase_(config.frequency),
33 target_playout_delay_( 33 target_playout_delay_(
34 base::TimeDelta::FromMilliseconds(config.rtp_max_delay_ms)), 34 base::TimeDelta::FromMilliseconds(config.rtp_max_delay_ms)),
35 expected_frame_duration_( 35 expected_frame_duration_(
36 base::TimeDelta::FromSeconds(1) / config.max_frame_rate), 36 base::TimeDelta::FromSeconds(1) / config.max_frame_rate),
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 rtcp_.SendRtcpFromRtpReceiver(&cast_message, &rtcp_events); 186 rtcp_.SendRtcpFromRtpReceiver(&cast_message, &rtcp_events);
187 } 187 }
188 188
189 void FrameReceiver::EmitAvailableEncodedFrames() { 189 void FrameReceiver::EmitAvailableEncodedFrames() {
190 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 190 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
191 191
192 while (!frame_request_queue_.empty()) { 192 while (!frame_request_queue_.empty()) {
193 // Attempt to peek at the next completed frame from the |framer_|. 193 // Attempt to peek at the next completed frame from the |framer_|.
194 // TODO(miu): We should only be peeking at the metadata, and not copying the 194 // TODO(miu): We should only be peeking at the metadata, and not copying the
195 // payload yet! Or, at least, peek using a StringPiece instead of a copy. 195 // payload yet! Or, at least, peek using a StringPiece instead of a copy.
196 scoped_ptr<transport::EncodedFrame> encoded_frame( 196 scoped_ptr<EncodedFrame> encoded_frame(
197 new transport::EncodedFrame()); 197 new EncodedFrame());
198 bool is_consecutively_next_frame = false; 198 bool is_consecutively_next_frame = false;
199 bool have_multiple_complete_frames = false; 199 bool have_multiple_complete_frames = false;
200 if (!framer_.GetEncodedFrame(encoded_frame.get(), 200 if (!framer_.GetEncodedFrame(encoded_frame.get(),
201 &is_consecutively_next_frame, 201 &is_consecutively_next_frame,
202 &have_multiple_complete_frames)) { 202 &have_multiple_complete_frames)) {
203 VLOG(1) << "Wait for more packets to produce a completed frame."; 203 VLOG(1) << "Wait for more packets to produce a completed frame.";
204 return; // ProcessParsedPacket() will invoke this method in the future. 204 return; // ProcessParsedPacket() will invoke this method in the future.
205 } 205 }
206 206
207 const base::TimeTicks now = cast_environment_->Clock()->NowTicks(); 207 const base::TimeTicks now = cast_environment_->Clock()->NowTicks();
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 } 317 }
318 318
319 void FrameReceiver::SendNextRtcpReport() { 319 void FrameReceiver::SendNextRtcpReport() {
320 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 320 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
321 rtcp_.SendRtcpFromRtpReceiver(NULL, NULL); 321 rtcp_.SendRtcpFromRtpReceiver(NULL, NULL);
322 ScheduleNextRtcpReport(); 322 ScheduleNextRtcpReport();
323 } 323 }
324 324
325 } // namespace cast 325 } // namespace cast
326 } // namespace media 326 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/receiver/frame_receiver.h ('k') | media/cast/receiver/frame_receiver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698