| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "media/base/callback.h" | 6 #include "media/base/callback.h" |
| 7 #include "media/base/data_buffer.h" | 7 #include "media/base/data_buffer.h" |
| 8 #include "media/base/media.h" | 8 #include "media/base/media.h" |
| 9 #include "remoting/base/capture_data.h" | 9 #include "remoting/base/capture_data.h" |
| 10 #include "remoting/base/encoder_vp8.h" | 10 #include "remoting/base/encoder_vp8.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 181 |
| 182 while (!got_data) { | 182 while (!got_data) { |
| 183 const vpx_codec_cx_pkt_t* packet = vpx_codec_get_cx_data(codec_.get(), | 183 const vpx_codec_cx_pkt_t* packet = vpx_codec_get_cx_data(codec_.get(), |
| 184 &iter); | 184 &iter); |
| 185 if (!packet) | 185 if (!packet) |
| 186 continue; | 186 continue; |
| 187 | 187 |
| 188 switch (packet->kind) { | 188 switch (packet->kind) { |
| 189 case VPX_CODEC_CX_FRAME_PKT: | 189 case VPX_CODEC_CX_FRAME_PKT: |
| 190 got_data = true; | 190 got_data = true; |
| 191 message->set_data( | 191 message->set_data(packet->data.frame.buf, packet->data.frame.sz); |
| 192 packet->data.frame.buf, packet->data.frame.sz); | |
| 193 break; | 192 break; |
| 194 default: | 193 default: |
| 195 break; | 194 break; |
| 196 } | 195 } |
| 197 } | 196 } |
| 198 | 197 |
| 199 message->mutable_format()->set_encoding(VideoPacketFormat::ENCODING_VP8); | 198 message->mutable_format()->set_encoding(VideoPacketFormat::ENCODING_VP8); |
| 200 message->set_flags(VideoPacket::FIRST_PACKET | VideoPacket::LAST_PACKET); | 199 message->set_flags(VideoPacket::FIRST_PACKET | VideoPacket::LAST_PACKET); |
| 201 message->mutable_format()->set_pixel_format(PIXEL_FORMAT_RGB32); | 200 message->mutable_format()->set_pixel_format(PIXEL_FORMAT_RGB32); |
| 202 message->mutable_format()->set_x(0); | 201 message->mutable_format()->set_x(0); |
| 203 message->mutable_format()->set_y(0); | 202 message->mutable_format()->set_y(0); |
| 204 message->mutable_format()->set_width(capture_data->width()); | 203 message->mutable_format()->set_width(capture_data->width()); |
| 205 message->mutable_format()->set_height(capture_data->height()); | 204 message->mutable_format()->set_height(capture_data->height()); |
| 206 | 205 |
| 207 data_available_callback->Run(message); | 206 data_available_callback->Run(message); |
| 208 delete data_available_callback; | 207 delete data_available_callback; |
| 209 } | 208 } |
| 210 | 209 |
| 211 } // namespace remoting | 210 } // namespace remoting |
| OLD | NEW |