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

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

Issue 1709863002: Add Cast PLI support on sender side. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Separate Pli message from Cast message. Created 4 years, 10 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
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 #include <string> 8 #include <string>
9 9
10 #include "base/big_endian.h" 10 #include "base/big_endian.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 ack_sent_event->type = FRAME_ACK_SENT; 190 ack_sent_event->type = FRAME_ACK_SENT;
191 ack_sent_event->media_type = event_media_type_; 191 ack_sent_event->media_type = event_media_type_;
192 ack_sent_event->rtp_timestamp = rtp_timestamp; 192 ack_sent_event->rtp_timestamp = rtp_timestamp;
193 ack_sent_event->frame_id = cast_message.ack_frame_id; 193 ack_sent_event->frame_id = cast_message.ack_frame_id;
194 cast_environment_->logger()->DispatchFrameEvent(std::move(ack_sent_event)); 194 cast_environment_->logger()->DispatchFrameEvent(std::move(ack_sent_event));
195 195
196 ReceiverRtcpEventSubscriber::RtcpEvents rtcp_events; 196 ReceiverRtcpEventSubscriber::RtcpEvents rtcp_events;
197 event_subscriber_.GetRtcpEventsWithRedundancy(&rtcp_events); 197 event_subscriber_.GetRtcpEventsWithRedundancy(&rtcp_events);
198 transport_->SendRtcpFromRtpReceiver( 198 transport_->SendRtcpFromRtpReceiver(
199 rtcp_.local_ssrc(), rtcp_.remote_ssrc(), CreateRtcpTimeData(now), 199 rtcp_.local_ssrc(), rtcp_.remote_ssrc(), CreateRtcpTimeData(now),
200 &cast_message, target_playout_delay_, &rtcp_events, NULL); 200 &cast_message, nullptr, target_playout_delay_, &rtcp_events, nullptr);
201 } 201 }
202 202
203 void FrameReceiver::EmitAvailableEncodedFrames() { 203 void FrameReceiver::EmitAvailableEncodedFrames() {
204 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 204 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
205 205
206 while (!frame_request_queue_.empty()) { 206 while (!frame_request_queue_.empty()) {
207 // Attempt to peek at the next completed frame from the |framer_|. 207 // Attempt to peek at the next completed frame from the |framer_|.
208 // TODO(miu): We should only be peeking at the metadata, and not copying the 208 // TODO(miu): We should only be peeking at the metadata, and not copying the
209 // payload yet! Or, at least, peek using a StringPiece instead of a copy. 209 // payload yet! Or, at least, peek using a StringPiece instead of a copy.
210 scoped_ptr<EncodedFrame> encoded_frame( 210 scoped_ptr<EncodedFrame> encoded_frame(
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 base::Bind(&FrameReceiver::SendNextRtcpReport, 343 base::Bind(&FrameReceiver::SendNextRtcpReport,
344 weak_factory_.GetWeakPtr()), 344 weak_factory_.GetWeakPtr()),
345 base::TimeDelta::FromMilliseconds(kRtcpReportIntervalMs)); 345 base::TimeDelta::FromMilliseconds(kRtcpReportIntervalMs));
346 } 346 }
347 347
348 void FrameReceiver::SendNextRtcpReport() { 348 void FrameReceiver::SendNextRtcpReport() {
349 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 349 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
350 const base::TimeTicks now = cast_environment_->Clock()->NowTicks(); 350 const base::TimeTicks now = cast_environment_->Clock()->NowTicks();
351 RtpReceiverStatistics stats = stats_.GetStatistics(); 351 RtpReceiverStatistics stats = stats_.GetStatistics();
352 transport_->SendRtcpFromRtpReceiver(rtcp_.local_ssrc(), rtcp_.remote_ssrc(), 352 transport_->SendRtcpFromRtpReceiver(rtcp_.local_ssrc(), rtcp_.remote_ssrc(),
353 CreateRtcpTimeData(now), NULL, 353 CreateRtcpTimeData(now), nullptr, nullptr,
354 base::TimeDelta(), NULL, &stats); 354 base::TimeDelta(), nullptr, &stats);
355 ScheduleNextRtcpReport(); 355 ScheduleNextRtcpReport();
356 } 356 }
357 357
358 } // namespace cast 358 } // namespace cast
359 } // namespace media 359 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698