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

Side by Side Diff: media/cast/framer/framer.h

Issue 23467003: Added framer to cast. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rtcp
Patch Set: Addressed comments Created 7 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
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_CAST_FRAMER_FRAMER_H_
6 #define MEDIA_CAST_FRAMER_FRAMER_H_
7
8 #include <map>
9
10 #include "base/basictypes.h"
11 #include "base/memory/linked_ptr.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/time/default_tick_clock.h"
14 #include "base/time/tick_clock.h"
15 #include "base/time/time.h"
16 #include "media/cast/framer/cast_message_builder.h"
17 #include "media/cast/framer/frame_buffer.h"
18 #include "media/cast/framer/frame_id_map.h"
19 #include "media/cast/rtcp/rtcp.h"
20 #include "media/cast/rtp_common/rtp_defines.h"
21
22 namespace media {
23 namespace cast {
24
25 typedef std::map<uint8, linked_ptr<FrameBuffer> > FrameList;
26
27 class Framer {
28 public:
29 Framer(RtpPayloadFeedback* incoming_payload_feedback,
30 uint32 ssrc,
31 bool decoder_faster_than_max_frame_rate,
32 int max_unacked_frames);
33 ~Framer();
34
35 void InsertPacket(const uint8* payload_data,
36 int payload_size,
37 const RtpCastHeader& rtp_header);
38
39 // Extracts a complete encoded frame - will only return a complete continuous
40 // frame.
41 // Returns false if the frame does not exist or if the frame is not complete
42 // within the given time frame.
43 bool GetEncodedVideoFrame(const base::TimeTicks& timeout,
44 EncodedVideoFrame* video_frame,
45 uint32* rtp_timestamp,
46 bool* next_frame);
47
48 bool GetEncodedAudioFrame(const base::TimeTicks& timeout,
49 EncodedAudioFrame* audio_frame,
50 uint32* rtp_timestamp,
51 bool* next_frame);
52
53 void ReleaseFrame(uint8 frame_id);
54
55 // Reset framer state to original state and flush all pending buffers.
56 void Reset();
57 bool TimeToSendNextCastMessage(base::TimeTicks* time_to_send);
58 void SendCastMessage();
59
60 void set_clock(base::TickClock* clock) {
61 clock_ = clock;
62 cast_msg_builder_->set_clock(clock);
63 }
64
65 private:
66 // Return true if we should wait.
67 bool WaitForNextFrame(const base::TimeTicks& timeout) const;
68
69 const bool decoder_faster_than_max_frame_rate_;
70 FrameList frames_;
71 FrameIdMap frame_id_map_;
72
73 base::DefaultTickClock default_tick_clock_;
74 base::TickClock* clock_;
75
76 scoped_ptr<CastMessageBuilder> cast_msg_builder_;
77
78 DISALLOW_COPY_AND_ASSIGN(Framer);
79 };
80
81 } // namespace cast
82 } // namespace media
83
84 #endif // MEDIA_CAST_FRAMER_FRAMER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698