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

Side by Side Diff: media/cast/framer/frame_buffer.cc

Issue 126843003: Revert of Cast:Adding cast_transport_config and cleaning up (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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/framer/frame_buffer.h ('k') | media/cast/framer/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/framer/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 {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 retval.first->second.begin()); 54 retval.first->second.begin());
55 55
56 ++num_packets_received_; 56 ++num_packets_received_;
57 total_data_size_ += payload_size; 57 total_data_size_ += payload_size;
58 } 58 }
59 59
60 bool FrameBuffer::Complete() const { 60 bool FrameBuffer::Complete() const {
61 return num_packets_received_ - 1 == max_packet_id_; 61 return num_packets_received_ - 1 == max_packet_id_;
62 } 62 }
63 63
64 bool FrameBuffer::GetEncodedAudioFrame( 64 bool FrameBuffer::GetEncodedAudioFrame(EncodedAudioFrame* audio_frame,
65 transport::EncodedAudioFrame* audio_frame, 65 uint32* rtp_timestamp) const {
66 uint32* rtp_timestamp) const {
67 if (!Complete()) return false; 66 if (!Complete()) return false;
68 67
69 *rtp_timestamp = rtp_timestamp_; 68 *rtp_timestamp = rtp_timestamp_;
70 69
71 // Frame is complete -> construct. 70 // Frame is complete -> construct.
72 audio_frame->frame_id = frame_id_; 71 audio_frame->frame_id = frame_id_;
73 72
74 // Build the data vector. 73 // Build the data vector.
75 audio_frame->data.clear(); 74 audio_frame->data.clear();
76 audio_frame->data.reserve(total_data_size_); 75 audio_frame->data.reserve(total_data_size_);
77 PacketMap::const_iterator it; 76 PacketMap::const_iterator it;
78 for (it = packets_.begin(); it != packets_.end(); ++it) { 77 for (it = packets_.begin(); it != packets_.end(); ++it) {
79 audio_frame->data.insert(audio_frame->data.end(), 78 audio_frame->data.insert(audio_frame->data.end(),
80 it->second.begin(), it->second.end()); 79 it->second.begin(), it->second.end());
81 } 80 }
82 return true; 81 return true;
83 } 82 }
84 83
85 bool FrameBuffer::GetEncodedVideoFrame( 84 bool FrameBuffer::GetEncodedVideoFrame(EncodedVideoFrame* video_frame,
86 transport::EncodedVideoFrame* video_frame, 85 uint32* rtp_timestamp) const {
87 uint32* rtp_timestamp) const {
88 if (!Complete()) return false; 86 if (!Complete()) return false;
89 87
90 *rtp_timestamp = rtp_timestamp_; 88 *rtp_timestamp = rtp_timestamp_;
91 89
92 // Frame is complete -> construct. 90 // Frame is complete -> construct.
93 video_frame->key_frame = is_key_frame_; 91 video_frame->key_frame = is_key_frame_;
94 video_frame->frame_id = frame_id_; 92 video_frame->frame_id = frame_id_;
95 video_frame->last_referenced_frame_id = last_referenced_frame_id_; 93 video_frame->last_referenced_frame_id = last_referenced_frame_id_;
96 94
97 // Build the data vector. 95 // Build the data vector.
98 video_frame->data.clear(); 96 video_frame->data.clear();
99 video_frame->data.reserve(total_data_size_); 97 video_frame->data.reserve(total_data_size_);
100 PacketMap::const_iterator it; 98 PacketMap::const_iterator it;
101 for (it = packets_.begin(); it != packets_.end(); ++it) { 99 for (it = packets_.begin(); it != packets_.end(); ++it) {
102 video_frame->data.insert(video_frame->data.end(), 100 video_frame->data.insert(video_frame->data.end(),
103 it->second.begin(), it->second.end()); 101 it->second.begin(), it->second.end());
104 } 102 }
105 return true; 103 return true;
106 } 104 }
107 105
108 } // namespace cast 106 } // namespace cast
109 } // namespace media 107 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/framer/frame_buffer.h ('k') | media/cast/framer/frame_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698