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

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

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, 3 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
« no previous file with comments | « no previous file | media/cast/receiver/frame_receiver.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 #ifndef MEDIA_CAST_RECEIVER_FRAME_RECEIVER_H_ 5 #ifndef MEDIA_CAST_RECEIVER_FRAME_RECEIVER_H_
6 #define MEDIA_CAST_RECEIVER_FRAME_RECEIVER_H_ 6 #define MEDIA_CAST_RECEIVER_FRAME_RECEIVER_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // Processes ready-to-consume packets from |framer_|, decrypting each packet's 82 // Processes ready-to-consume packets from |framer_|, decrypting each packet's
83 // payload data, and then running the enqueued callbacks in order (one for 83 // payload data, and then running the enqueued callbacks in order (one for
84 // each packet). This method may post a delayed task to re-invoke itself in 84 // each packet). This method may post a delayed task to re-invoke itself in
85 // the future to wait for missing/incomplete frames. 85 // the future to wait for missing/incomplete frames.
86 void EmitAvailableEncodedFrames(); 86 void EmitAvailableEncodedFrames();
87 87
88 // Clears the |is_waiting_for_consecutive_frame_| flag and invokes 88 // Clears the |is_waiting_for_consecutive_frame_| flag and invokes
89 // EmitAvailableEncodedFrames(). 89 // EmitAvailableEncodedFrames().
90 void EmitAvailableEncodedFramesAfterWaiting(); 90 void EmitAvailableEncodedFramesAfterWaiting();
91 91
92 // Helper that runs |callback|, passing ownership of |encoded_frame| to it.
93 // This method is used by EmitAvailableEncodedFrames() to return to the event
94 // loop, but make sure that FrameReceiver is still alive before the callback
95 // is run.
96 void EmitOneFrame(const ReceiveEncodedFrameCallback& callback,
97 scoped_ptr<EncodedFrame> encoded_frame) const;
98
92 // Computes the playout time for a frame with the given |rtp_timestamp|. 99 // Computes the playout time for a frame with the given |rtp_timestamp|.
93 // Because lip-sync info is refreshed regularly, calling this method with the 100 // Because lip-sync info is refreshed regularly, calling this method with the
94 // same argument may return different results. 101 // same argument may return different results.
95 base::TimeTicks GetPlayoutTime(const EncodedFrame& frame) const; 102 base::TimeTicks GetPlayoutTime(const EncodedFrame& frame) const;
96 103
97 // Schedule timing for the next cast message. 104 // Schedule timing for the next cast message.
98 void ScheduleNextCastMessage(); 105 void ScheduleNextCastMessage();
99 106
100 // Schedule timing for the next RTCP report. 107 // Schedule timing for the next RTCP report.
101 void ScheduleNextRtcpReport(); 108 void ScheduleNextRtcpReport();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // NOTE: Weak pointers must be invalidated before all other member variables. 185 // NOTE: Weak pointers must be invalidated before all other member variables.
179 base::WeakPtrFactory<FrameReceiver> weak_factory_; 186 base::WeakPtrFactory<FrameReceiver> weak_factory_;
180 187
181 DISALLOW_COPY_AND_ASSIGN(FrameReceiver); 188 DISALLOW_COPY_AND_ASSIGN(FrameReceiver);
182 }; 189 };
183 190
184 } // namespace cast 191 } // namespace cast
185 } // namespace media 192 } // namespace media
186 193
187 #endif // MEDIA_CAST_RECEIVER_FRAME_RECEIVER_H_ 194 #endif // MEDIA_CAST_RECEIVER_FRAME_RECEIVER_H_
OLDNEW
« no previous file with comments | « no previous file | media/cast/receiver/frame_receiver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698