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

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

Issue 491953003: [Cast] Fix shutdown race between CastReceiverImpl/FrameReceiver and frame emit callback run. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 0e794cdb27562096834a3f728f55ed6851c4ffa6..6b5ef86a4c3c4e00598af30da09b4b5b0e5a87eb 100644
--- a/media/cast/receiver/frame_receiver.cc
+++ b/media/cast/receiver/frame_receiver.cc
@@ -256,7 +256,9 @@ void FrameReceiver::EmitAvailableEncodedFrames() {
}
cast_environment_->PostTask(CastEnvironment::MAIN,
FROM_HERE,
- base::Bind(frame_request_queue_.front(),
+ base::Bind(&FrameReceiver::EmitOneFrame,
+ weak_factory_.GetWeakPtr(),
+ frame_request_queue_.front(),
base::Passed(&encoded_frame)));
frame_request_queue_.pop_front();
}
@@ -269,6 +271,13 @@ void FrameReceiver::EmitAvailableEncodedFramesAfterWaiting() {
EmitAvailableEncodedFrames();
}
+void FrameReceiver::EmitOneFrame(const ReceiveEncodedFrameCallback& callback,
+ scoped_ptr<EncodedFrame> encoded_frame) const {
+ DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
+ if (!callback.is_null())
+ callback.Run(encoded_frame.Pass());
+}
+
base::TimeTicks FrameReceiver::GetPlayoutTime(const EncodedFrame& frame) const {
base::TimeDelta target_playout_delay = target_playout_delay_;
if (frame.new_playout_delay_ms) {
« 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