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

Unified Diff: media/cast/receiver/frame_receiver.cc

Issue 2875043003: Remove base::SupportsWeakPtr from FrameReceiver (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/cast/receiver/frame_receiver.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/receiver/frame_receiver.cc
diff --git a/media/cast/receiver/frame_receiver.cc b/media/cast/receiver/frame_receiver.cc
index 257862e9460bfd3372ff7aad4c4332f4fab11fde..d700538a673ad860bf556098e5b1b93a4bb78f7a 100644
--- a/media/cast/receiver/frame_receiver.cc
+++ b/media/cast/receiver/frame_receiver.cc
@@ -113,6 +113,10 @@ bool FrameReceiver::ProcessPacket(std::unique_ptr<Packet> packet) {
return true;
}
+base::WeakPtr<FrameReceiver> FrameReceiver::AsWeakPtr() {
+ return weak_factory_.GetWeakPtr();
+}
+
void FrameReceiver::ProcessParsedPacket(const RtpCastHeader& rtp_header,
const uint8_t* payload_data,
size_t payload_size) {
@@ -242,10 +246,9 @@ void FrameReceiver::EmitAvailableEncodedFrames() {
if (!is_waiting_for_consecutive_frame_) {
is_waiting_for_consecutive_frame_ = true;
cast_environment_->PostDelayedTask(
- CastEnvironment::MAIN,
- FROM_HERE,
+ CastEnvironment::MAIN, FROM_HERE,
base::Bind(&FrameReceiver::EmitAvailableEncodedFramesAfterWaiting,
- weak_factory_.GetWeakPtr()),
+ AsWeakPtr()),
playout_time - now);
}
return;
@@ -277,12 +280,10 @@ void FrameReceiver::EmitAvailableEncodedFrames() {
target_playout_delay_ = base::TimeDelta::FromMilliseconds(
encoded_frame->new_playout_delay_ms);
}
- cast_environment_->PostTask(CastEnvironment::MAIN,
- FROM_HERE,
- base::Bind(&FrameReceiver::EmitOneFrame,
- weak_factory_.GetWeakPtr(),
- frame_request_queue_.front(),
- base::Passed(&encoded_frame)));
+ cast_environment_->PostTask(
+ CastEnvironment::MAIN, FROM_HERE,
+ base::Bind(&FrameReceiver::EmitOneFrame, AsWeakPtr(),
+ frame_request_queue_.front(), base::Passed(&encoded_frame)));
frame_request_queue_.pop_front();
}
}
@@ -323,10 +324,8 @@ void FrameReceiver::ScheduleNextCastMessage() {
time_to_send = std::max(
time_to_send, base::TimeDelta::FromMilliseconds(kMinSchedulingDelayMs));
cast_environment_->PostDelayedTask(
- CastEnvironment::MAIN,
- FROM_HERE,
- base::Bind(&FrameReceiver::SendNextCastMessage,
- weak_factory_.GetWeakPtr()),
+ CastEnvironment::MAIN, FROM_HERE,
+ base::Bind(&FrameReceiver::SendNextCastMessage, AsWeakPtr()),
time_to_send);
}
@@ -341,8 +340,7 @@ void FrameReceiver::ScheduleNextRtcpReport() {
cast_environment_->PostDelayedTask(
CastEnvironment::MAIN, FROM_HERE,
- base::Bind(&FrameReceiver::SendNextRtcpReport,
- weak_factory_.GetWeakPtr()),
+ base::Bind(&FrameReceiver::SendNextRtcpReport, AsWeakPtr()),
base::TimeDelta::FromMilliseconds(kRtcpReportIntervalMs));
}
« no previous file with comments | « media/cast/receiver/frame_receiver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698