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

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

Issue 1905763002: Convert //media/cast from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « media/cast/receiver/cast_receiver_impl.cc ('k') | 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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <list> 11 #include <list>
12 #include <memory>
12 13
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "media/cast/cast_receiver.h" 18 #include "media/cast/cast_receiver.h"
19 #include "media/cast/common/clock_drift_smoother.h" 19 #include "media/cast/common/clock_drift_smoother.h"
20 #include "media/cast/common/rtp_time.h" 20 #include "media/cast/common/rtp_time.h"
21 #include "media/cast/common/transport_encryption_handler.h" 21 #include "media/cast/common/transport_encryption_handler.h"
22 #include "media/cast/logging/logging_defines.h" 22 #include "media/cast/logging/logging_defines.h"
23 #include "media/cast/net/rtcp/receiver_rtcp_event_subscriber.h" 23 #include "media/cast/net/rtcp/receiver_rtcp_event_subscriber.h"
24 #include "media/cast/net/rtcp/receiver_rtcp_session.h" 24 #include "media/cast/net/rtcp/receiver_rtcp_session.h"
25 #include "media/cast/net/rtp/framer.h" 25 #include "media/cast/net/rtp/framer.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 ~FrameReceiver() final; 61 ~FrameReceiver() final;
62 62
63 // Request an encoded frame. 63 // Request an encoded frame.
64 // 64 //
65 // The given |callback| is guaranteed to be run at some point in the future, 65 // The given |callback| is guaranteed to be run at some point in the future,
66 // except for those requests still enqueued at destruction time. 66 // except for those requests still enqueued at destruction time.
67 void RequestEncodedFrame(const ReceiveEncodedFrameCallback& callback); 67 void RequestEncodedFrame(const ReceiveEncodedFrameCallback& callback);
68 68
69 // Called to deliver another packet, possibly a duplicate, and possibly 69 // Called to deliver another packet, possibly a duplicate, and possibly
70 // out-of-order. Returns true if the parsing of the packet succeeded. 70 // out-of-order. Returns true if the parsing of the packet succeeded.
71 bool ProcessPacket(scoped_ptr<Packet> packet); 71 bool ProcessPacket(std::unique_ptr<Packet> packet);
72 72
73 protected: 73 protected:
74 friend class FrameReceiverTest; // Invokes ProcessParsedPacket(). 74 friend class FrameReceiverTest; // Invokes ProcessParsedPacket().
75 75
76 void ProcessParsedPacket(const RtpCastHeader& rtp_header, 76 void ProcessParsedPacket(const RtpCastHeader& rtp_header,
77 const uint8_t* payload_data, 77 const uint8_t* payload_data,
78 size_t payload_size); 78 size_t payload_size);
79 79
80 // RtpPayloadFeedback implementation. 80 // RtpPayloadFeedback implementation.
81 void CastFeedback(const RtcpCastMessage& cast_message) final; 81 void CastFeedback(const RtcpCastMessage& cast_message) final;
82 82
83 private: 83 private:
84 // Processes ready-to-consume packets from |framer_|, decrypting each packet's 84 // Processes ready-to-consume packets from |framer_|, decrypting each packet's
85 // payload data, and then running the enqueued callbacks in order (one for 85 // payload data, and then running the enqueued callbacks in order (one for
86 // each packet). This method may post a delayed task to re-invoke itself in 86 // each packet). This method may post a delayed task to re-invoke itself in
87 // the future to wait for missing/incomplete frames. 87 // the future to wait for missing/incomplete frames.
88 void EmitAvailableEncodedFrames(); 88 void EmitAvailableEncodedFrames();
89 89
90 // Clears the |is_waiting_for_consecutive_frame_| flag and invokes 90 // Clears the |is_waiting_for_consecutive_frame_| flag and invokes
91 // EmitAvailableEncodedFrames(). 91 // EmitAvailableEncodedFrames().
92 void EmitAvailableEncodedFramesAfterWaiting(); 92 void EmitAvailableEncodedFramesAfterWaiting();
93 93
94 // Helper that runs |callback|, passing ownership of |encoded_frame| to it. 94 // Helper that runs |callback|, passing ownership of |encoded_frame| to it.
95 // This method is used by EmitAvailableEncodedFrames() to return to the event 95 // This method is used by EmitAvailableEncodedFrames() to return to the event
96 // loop, but make sure that FrameReceiver is still alive before the callback 96 // loop, but make sure that FrameReceiver is still alive before the callback
97 // is run. 97 // is run.
98 void EmitOneFrame(const ReceiveEncodedFrameCallback& callback, 98 void EmitOneFrame(const ReceiveEncodedFrameCallback& callback,
99 scoped_ptr<EncodedFrame> encoded_frame) const; 99 std::unique_ptr<EncodedFrame> encoded_frame) const;
100 100
101 // Computes the playout time for a frame with the given |rtp_timestamp|. 101 // Computes the playout time for a frame with the given |rtp_timestamp|.
102 // Because lip-sync info is refreshed regularly, calling this method with the 102 // Because lip-sync info is refreshed regularly, calling this method with the
103 // same argument may return different results. 103 // same argument may return different results.
104 base::TimeTicks GetPlayoutTime(const EncodedFrame& frame) const; 104 base::TimeTicks GetPlayoutTime(const EncodedFrame& frame) const;
105 105
106 // Schedule timing for the next cast message. 106 // Schedule timing for the next cast message.
107 void ScheduleNextCastMessage(); 107 void ScheduleNextCastMessage();
108 108
109 // Schedule timing for the next RTCP report. 109 // Schedule timing for the next RTCP report.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 // NOTE: Weak pointers must be invalidated before all other member variables. 203 // NOTE: Weak pointers must be invalidated before all other member variables.
204 base::WeakPtrFactory<FrameReceiver> weak_factory_; 204 base::WeakPtrFactory<FrameReceiver> weak_factory_;
205 205
206 DISALLOW_COPY_AND_ASSIGN(FrameReceiver); 206 DISALLOW_COPY_AND_ASSIGN(FrameReceiver);
207 }; 207 };
208 208
209 } // namespace cast 209 } // namespace cast
210 } // namespace media 210 } // namespace media
211 211
212 #endif // MEDIA_CAST_RECEIVER_FRAME_RECEIVER_H_ 212 #endif // MEDIA_CAST_RECEIVER_FRAME_RECEIVER_H_
OLDNEW
« no previous file with comments | « media/cast/receiver/cast_receiver_impl.cc ('k') | media/cast/receiver/frame_receiver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698