| OLD | NEW |
| 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/base/video_frame.h" | 5 #include "media/base/video_frame.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <climits> | 8 #include <climits> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 LOG(DFATAL) << __FUNCTION__ << " Invalid config." | 509 LOG(DFATAL) << __FUNCTION__ << " Invalid config." |
| 510 << ConfigToString(frame->format(), frame->storage_type(), | 510 << ConfigToString(frame->format(), frame->storage_type(), |
| 511 frame->coded_size(), visible_rect, | 511 frame->coded_size(), visible_rect, |
| 512 natural_size); | 512 natural_size); |
| 513 return nullptr; | 513 return nullptr; |
| 514 } | 514 } |
| 515 | 515 |
| 516 scoped_refptr<VideoFrame> wrapping_frame(new VideoFrame( | 516 scoped_refptr<VideoFrame> wrapping_frame(new VideoFrame( |
| 517 frame->format(), frame->storage_type(), frame->coded_size(), visible_rect, | 517 frame->format(), frame->storage_type(), frame->coded_size(), visible_rect, |
| 518 natural_size, frame->timestamp())); | 518 natural_size, frame->timestamp())); |
| 519 if (frame->metadata()->IsTrue(VideoFrameMetadata::END_OF_STREAM)) { | 519 |
| 520 wrapping_frame->metadata()->SetBoolean(VideoFrameMetadata::END_OF_STREAM, | 520 // Copy all metadata to the wrapped frame. |
| 521 true); | 521 wrapping_frame->metadata()->MergeMetadataFrom(frame->metadata()); |
| 522 } | |
| 523 | 522 |
| 524 for (size_t i = 0; i < NumPlanes(frame->format()); ++i) { | 523 for (size_t i = 0; i < NumPlanes(frame->format()); ++i) { |
| 525 wrapping_frame->strides_[i] = frame->stride(i); | 524 wrapping_frame->strides_[i] = frame->stride(i); |
| 526 wrapping_frame->data_[i] = frame->data(i); | 525 wrapping_frame->data_[i] = frame->data(i); |
| 527 } | 526 } |
| 528 | 527 |
| 529 #if defined(OS_LINUX) | 528 #if defined(OS_LINUX) |
| 530 // If there are any |dmabuf_fds_| plugged in, we should duplicate them. | 529 // If there are any |dmabuf_fds_| plugged in, we should duplicate them. |
| 531 if (frame->storage_type() == STORAGE_DMABUFS) { | 530 if (frame->storage_type() == STORAGE_DMABUFS) { |
| 532 std::vector<int> original_fds; | 531 std::vector<int> original_fds; |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 if (zero_initialize_memory) | 1079 if (zero_initialize_memory) |
| 1081 memset(data, 0, data_size); | 1080 memset(data, 0, data_size); |
| 1082 | 1081 |
| 1083 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) | 1082 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) |
| 1084 data_[plane] = data + offset[plane]; | 1083 data_[plane] = data + offset[plane]; |
| 1085 | 1084 |
| 1086 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); | 1085 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); |
| 1087 } | 1086 } |
| 1088 | 1087 |
| 1089 } // namespace media | 1088 } // namespace media |
| OLD | NEW |