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

Side by Side Diff: media/cast/net/rtp/frame_buffer.cc

Issue 388663003: Cast: Reshuffle files under media/cast (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: missing includes Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « media/cast/net/rtp/frame_buffer.h ('k') | media/cast/net/rtp/frame_buffer_unittest.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 2013 The Chromium Authors. All rights reserved. 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 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 #include "media/cast/framer/frame_buffer.h" 5 #include "media/cast/net/rtp/frame_buffer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace media { 9 namespace media {
10 namespace cast { 10 namespace cast {
11 11
12 FrameBuffer::FrameBuffer() 12 FrameBuffer::FrameBuffer()
13 : frame_id_(0), 13 : frame_id_(0),
14 max_packet_id_(0), 14 max_packet_id_(0),
15 num_packets_received_(0), 15 num_packets_received_(0),
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 payload_data, payload_data + payload_size, retval.first->second.begin()); 52 payload_data, payload_data + payload_size, retval.first->second.begin());
53 53
54 ++num_packets_received_; 54 ++num_packets_received_;
55 total_data_size_ += payload_size; 55 total_data_size_ += payload_size;
56 } 56 }
57 57
58 bool FrameBuffer::Complete() const { 58 bool FrameBuffer::Complete() const {
59 return num_packets_received_ - 1 == max_packet_id_; 59 return num_packets_received_ - 1 == max_packet_id_;
60 } 60 }
61 61
62 bool FrameBuffer::AssembleEncodedFrame(transport::EncodedFrame* frame) const { 62 bool FrameBuffer::AssembleEncodedFrame(EncodedFrame* frame) const {
63 if (!Complete()) 63 if (!Complete())
64 return false; 64 return false;
65 65
66 // Frame is complete -> construct. 66 // Frame is complete -> construct.
67 if (is_key_frame_) 67 if (is_key_frame_)
68 frame->dependency = transport::EncodedFrame::KEY; 68 frame->dependency = EncodedFrame::KEY;
69 else if (frame_id_ == last_referenced_frame_id_) 69 else if (frame_id_ == last_referenced_frame_id_)
70 frame->dependency = transport::EncodedFrame::INDEPENDENT; 70 frame->dependency = EncodedFrame::INDEPENDENT;
71 else 71 else
72 frame->dependency = transport::EncodedFrame::DEPENDENT; 72 frame->dependency = EncodedFrame::DEPENDENT;
73 frame->frame_id = frame_id_; 73 frame->frame_id = frame_id_;
74 frame->referenced_frame_id = last_referenced_frame_id_; 74 frame->referenced_frame_id = last_referenced_frame_id_;
75 frame->rtp_timestamp = rtp_timestamp_; 75 frame->rtp_timestamp = rtp_timestamp_;
76 76
77 // Build the data vector. 77 // Build the data vector.
78 frame->data.clear(); 78 frame->data.clear();
79 frame->data.reserve(total_data_size_); 79 frame->data.reserve(total_data_size_);
80 PacketMap::const_iterator it; 80 PacketMap::const_iterator it;
81 for (it = packets_.begin(); it != packets_.end(); ++it) 81 for (it = packets_.begin(); it != packets_.end(); ++it)
82 frame->data.insert(frame->data.end(), it->second.begin(), it->second.end()); 82 frame->data.insert(frame->data.end(), it->second.begin(), it->second.end());
83 return true; 83 return true;
84 } 84 }
85 85
86 } // namespace cast 86 } // namespace cast
87 } // namespace media 87 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/net/rtp/frame_buffer.h ('k') | media/cast/net/rtp/frame_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698