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

Side by Side Diff: remoting/client/plugin/media_source_video_renderer.cc

Issue 291193008: Handle odd width and height in the MediaSource renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "remoting/client/plugin/media_source_video_renderer.h" 5 #include "remoting/client/plugin/media_source_video_renderer.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 base::Time::Exploded millennium_exploded; 58 base::Time::Exploded millennium_exploded;
59 memset(&millennium_exploded, 0, sizeof(millennium_exploded)); 59 memset(&millennium_exploded, 0, sizeof(millennium_exploded));
60 millennium_exploded.year = 2001; 60 millennium_exploded.year = 2001;
61 millennium_exploded.month = 1; 61 millennium_exploded.month = 1;
62 millennium_exploded.day_of_month = 1; 62 millennium_exploded.day_of_month = 1;
63 segment_->GetSegmentInfo()->set_date_utc( 63 segment_->GetSegmentInfo()->set_date_utc(
64 (base::Time::Now() - base::Time::FromUTCExploded(millennium_exploded)) 64 (base::Time::Now() - base::Time::FromUTCExploded(millennium_exploded))
65 .InMicroseconds() * 65 .InMicroseconds() *
66 base::Time::kNanosecondsPerMicrosecond); 66 base::Time::kNanosecondsPerMicrosecond);
67 67
68 segment_->AddVideoTrack(frame_size_.width(), frame_size_.height(), 1); 68 uint64 crop_right = 0;
69 int width = frame_size_.width();
70 if (width % 2 == 1) {
71 ++width;
72 crop_right = 1;
73 }
74
75 uint64 crop_bottom = 0;
76 int height = frame_size_.height();
77 if (height % 2 == 1) {
78 ++height;
79 crop_bottom = 1;
80 }
81
82 segment_->AddVideoTrack(width, height, 1);
69 mkvmuxer::VideoTrack* video_track = 83 mkvmuxer::VideoTrack* video_track =
70 reinterpret_cast<mkvmuxer::VideoTrack*>(segment_->GetTrackByNumber(1)); 84 reinterpret_cast<mkvmuxer::VideoTrack*>(segment_->GetTrackByNumber(1));
85 video_track->set_crop_right(crop_right);
86 video_track->set_crop_bottom(crop_bottom);
71 video_track->set_frame_rate(base::Time::kNanosecondsPerSecond / 87 video_track->set_frame_rate(base::Time::kNanosecondsPerSecond /
72 kFrameIntervalNs); 88 kFrameIntervalNs);
73 video_track->set_default_duration(base::Time::kNanosecondsPerSecond); 89 video_track->set_default_duration(base::Time::kNanosecondsPerSecond);
74 mkvmuxer::SegmentInfo* const info = segment_->GetSegmentInfo(); 90 mkvmuxer::SegmentInfo* const info = segment_->GetSegmentInfo();
75 info->set_writing_app("ChromotingViewer"); 91 info->set_writing_app("ChromotingViewer");
76 info->set_muxing_app("ChromotingViewer"); 92 info->set_muxing_app("ChromotingViewer");
77 } 93 }
78 94
79 MediaSourceVideoRenderer::VideoWriter::~VideoWriter() {} 95 MediaSourceVideoRenderer::VideoWriter::~VideoWriter() {}
80 96
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 desktop_shape_.Swap(&desktop_shape); 214 desktop_shape_.Swap(&desktop_shape);
199 delegate_->OnMediaSourceShape(desktop_shape_); 215 delegate_->OnMediaSourceShape(desktop_shape_);
200 } 216 }
201 217
202 scoped_ptr<VideoWriter::DataBuffer> buffer = 218 scoped_ptr<VideoWriter::DataBuffer> buffer =
203 writer_->OnVideoFrame(packet->data()); 219 writer_->OnVideoFrame(packet->data());
204 delegate_->OnMediaSourceData(&(*(buffer->begin())), buffer->size()); 220 delegate_->OnMediaSourceData(&(*(buffer->begin())), buffer->size());
205 } 221 }
206 222
207 } // namespace remoting 223 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698