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

Side by Side Diff: media/cast/sender/rtp_timestamp_helper.h

Issue 502333002: [Cast] In Audio/VideoSender, drop frames when too-long a duration is in-flight. (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
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_SENDER_RTP_TIMESTAMP_HELPER_H_ 5 #ifndef MEDIA_CAST_SENDER_RTP_TIMESTAMP_HELPER_H_
6 #define MEDIA_CAST_SENDER_RTP_TIMESTAMP_HELPER_H_ 6 #define MEDIA_CAST_SENDER_RTP_TIMESTAMP_HELPER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 10
11 namespace media { 11 namespace media {
12 namespace cast { 12 namespace cast {
13 13
14 // A helper class used to convert current time ticks into RTP timestamp. 14 // A helper class used to convert current time ticks into RTP timestamp.
15 class RtpTimestampHelper { 15 class RtpTimestampHelper {
16 public: 16 public:
17 explicit RtpTimestampHelper(int frequency); 17 explicit RtpTimestampHelper(int frequency);
18 ~RtpTimestampHelper(); 18 ~RtpTimestampHelper();
19 19
20 // Compute a RTP timestamp using current time, last encoded time and 20 int frequency() const { return frequency_; }
21 // last encoded RTP timestamp. 21
22 // Return true if |rtp_timestamp| is computed. 22 // Compute a RTP timestamp for |t|, based on the last stored capture time and
23 bool GetCurrentTimeAsRtpTimestamp(const base::TimeTicks& now, 23 // its corresponding RTP timestamp. Return true if |rtp_timestamp| is
24 uint32* rtp_timestamp) const; 24 // computed.
25 bool EstimateRtpTimestamp(const base::TimeTicks& t,
hubbe 2014/08/26 17:49:56 Why is it an estimate? Does it return "approximate
miu 2014/08/26 19:57:19 Yes. It's an estimate because, ultimately, it's t
hubbe 2014/08/26 20:54:21 If we do this with timeticks/deltas instead, do we
miu 2014/08/26 23:27:16 Done. This method is also used when generating SR
26 uint32* rtp_timestamp) const;
25 27
26 // Store the capture time and the corresponding RTP timestamp for the 28 // Store the capture time and the corresponding RTP timestamp for the
27 // last encoded frame. 29 // last encoded frame.
28 void StoreLatestTime(base::TimeTicks capture_time, uint32 rtp_timestamp); 30 void StoreLatestTime(base::TimeTicks capture_time, uint32 rtp_timestamp);
29 31
30 private: 32 private:
31 int frequency_; 33 int frequency_;
32 base::TimeTicks last_capture_time_; 34 base::TimeTicks last_capture_time_;
33 uint32 last_rtp_timestamp_; 35 uint32 last_rtp_timestamp_;
34 36
35 DISALLOW_COPY_AND_ASSIGN(RtpTimestampHelper); 37 DISALLOW_COPY_AND_ASSIGN(RtpTimestampHelper);
36 }; 38 };
37 39
38 } // namespace cast 40 } // namespace cast
39 } // namespace media 41 } // namespace media
40 42
41 #endif // MEDIA_CAST_SENDER_RTP_TIMESTAMP_HELPER_H_ 43 #endif // MEDIA_CAST_SENDER_RTP_TIMESTAMP_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698