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

Side by Side Diff: media/renderers/skcanvas_video_renderer.cc

Issue 2380673002: Clean up code to use VideoFrameMetadata::MergeMetadataFrom() when appropriate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean up code to use VideoFrameMetadata::MergeMetadataFrom() when appropriate. Created 4 years, 2 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
« no previous file with comments | « media/base/video_frame_unittest.cc ('k') | 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderers/skcanvas_video_renderer.h" 5 #include "media/renderers/skcanvas_video_renderer.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "gpu/GLES2/gl2extchromium.h" 10 #include "gpu/GLES2/gl2extchromium.h"
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 default: 470 default:
471 NOTREACHED(); 471 NOTREACHED();
472 return nullptr; 472 return nullptr;
473 } 473 }
474 scoped_refptr<VideoFrame> ret = VideoFrame::CreateFrame( 474 scoped_refptr<VideoFrame> ret = VideoFrame::CreateFrame(
475 format, video_frame->coded_size(), video_frame->visible_rect(), 475 format, video_frame->coded_size(), video_frame->visible_rect(),
476 video_frame->natural_size(), video_frame->timestamp()); 476 video_frame->natural_size(), video_frame->timestamp());
477 477
478 // Copy all metadata. 478 // Copy all metadata.
479 // (May be enough to copy color space) 479 // (May be enough to copy color space)
480 base::DictionaryValue tmp; 480 ret->metadata()->MergeMetadataFrom(video_frame->metadata());
481 video_frame->metadata()->MergeInternalValuesInto(&tmp);
482 ret->metadata()->MergeInternalValuesFrom(tmp);
483 481
484 for (int plane = VideoFrame::kYPlane; plane <= VideoFrame::kVPlane; ++plane) { 482 for (int plane = VideoFrame::kYPlane; plane <= VideoFrame::kVPlane; ++plane) {
485 int width = ret->row_bytes(plane); 483 int width = ret->row_bytes(plane);
486 const uint16_t* src = 484 const uint16_t* src =
487 reinterpret_cast<const uint16_t*>(video_frame->data(plane)); 485 reinterpret_cast<const uint16_t*>(video_frame->data(plane));
488 uint8_t* dst = ret->data(plane); 486 uint8_t* dst = ret->data(plane);
489 for (int row = 0; row < video_frame->rows(plane); row++) { 487 for (int row = 0; row < video_frame->rows(plane); row++) {
490 for (int x = 0; x < width; x++) { 488 for (int x = 0; x < width; x++) {
491 dst[x] = src[x] >> shift; 489 dst[x] = src[x] >> shift;
492 } 490 }
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 if (!last_image_) // Couldn't create the SkImage. 752 if (!last_image_) // Couldn't create the SkImage.
755 return false; 753 return false;
756 last_timestamp_ = video_frame->timestamp(); 754 last_timestamp_ = video_frame->timestamp();
757 } 755 }
758 last_image_deleting_timer_.Reset(); 756 last_image_deleting_timer_.Reset();
759 DCHECK(!!last_image_); 757 DCHECK(!!last_image_);
760 return true; 758 return true;
761 } 759 }
762 760
763 } // namespace media 761 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_frame_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698