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

Unified Diff: remoting/codec/video_encoder_vpx.cc

Issue 530243002: Move common VideoPacket initialization into VideoEncoderHelper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit tests 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/codec/video_encoder_vpx.h ('k') | remoting/host/video_frame_recorder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/codec/video_encoder_vpx.cc
diff --git a/remoting/codec/video_encoder_vpx.cc b/remoting/codec/video_encoder_vpx.cc
index 75b6d4eb363e2fdd6287d6b17d170b50300f9940..61d94c9c8b2b9da0837b10665406ddae2f1247f6 100644
--- a/remoting/codec/video_encoder_vpx.cc
+++ b/remoting/codec/video_encoder_vpx.cc
@@ -288,7 +288,9 @@ scoped_ptr<VideoPacket> VideoEncoderVpx::Encode(
// TODO(hclam): Make sure we get exactly one frame from the packet.
Sergey Ulanov 2014/09/03 01:11:25 this TODO can be removed
// TODO(hclam): We should provide the output buffer to avoid one copy.
- scoped_ptr<VideoPacket> packet(new VideoPacket());
+ scoped_ptr<VideoPacket> packet(
+ helper_.CreateVideoPacketWithUpdatedRegion(frame, updated_region));
+ packet->mutable_format()->set_encoding(VideoPacketFormat::ENCODING_VP8);
while (!got_data) {
const vpx_codec_cx_pkt_t* vpx_packet =
@@ -306,25 +308,9 @@ scoped_ptr<VideoPacket> VideoEncoderVpx::Encode(
}
}
- // Construct the VideoPacket message.
- packet->mutable_format()->set_encoding(VideoPacketFormat::ENCODING_VP8);
- packet->mutable_format()->set_screen_width(frame.size().width());
- packet->mutable_format()->set_screen_height(frame.size().height());
- packet->set_capture_time_ms(frame.capture_time_ms());
+ // Note the time taken to encode the pixel data.
packet->set_encode_time_ms(
(base::TimeTicks::Now() - encode_start_time).InMillisecondsRoundedUp());
- if (!frame.dpi().is_zero()) {
- packet->mutable_format()->set_x_dpi(frame.dpi().x());
- packet->mutable_format()->set_y_dpi(frame.dpi().y());
- }
- for (webrtc::DesktopRegion::Iterator r(updated_region); !r.IsAtEnd();
- r.Advance()) {
- Rect* rect = packet->add_dirty_rects();
- rect->set_x(r.rect().left());
- rect->set_y(r.rect().top());
- rect->set_width(r.rect().width());
- rect->set_height(r.rect().height());
- }
return packet.Pass();
}
« no previous file with comments | « remoting/codec/video_encoder_vpx.h ('k') | remoting/host/video_frame_recorder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698