Chromium Code Reviews| 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 metada to the wrapped frame |
|
watk
2016/03/02 21:25:16
s/metada/metadata
Full stop/period at the end of
tguilbert
2016/03/03 21:42:04
Done.
| |
| 521 true); | 521 base::DictionaryValue temp_metadata_values; |
| 522 } | 522 frame->metadata()->MergeInternalValuesInto(&temp_metadata_values); |
| 523 wrapping_frame->metadata()->MergeInternalValuesFrom(temp_metadata_values); | |
|
watk
2016/03/02 21:25:16
WDYT about adding a VideoFrameMetadata::MergeMetad
tguilbert
2016/03/03 21:42:04
I am fine with the idea. Should I pro-actively mod
watk
2016/03/03 22:54:33
Nice, I think a follow up CL to clean those up mak
| |
| 523 | 524 |
| 524 for (size_t i = 0; i < NumPlanes(frame->format()); ++i) { | 525 for (size_t i = 0; i < NumPlanes(frame->format()); ++i) { |
| 525 wrapping_frame->strides_[i] = frame->stride(i); | 526 wrapping_frame->strides_[i] = frame->stride(i); |
| 526 wrapping_frame->data_[i] = frame->data(i); | 527 wrapping_frame->data_[i] = frame->data(i); |
| 527 } | 528 } |
| 528 | 529 |
| 529 #if defined(OS_LINUX) | 530 #if defined(OS_LINUX) |
| 530 // If there are any |dmabuf_fds_| plugged in, we should duplicate them. | 531 // If there are any |dmabuf_fds_| plugged in, we should duplicate them. |
| 531 if (frame->storage_type() == STORAGE_DMABUFS) { | 532 if (frame->storage_type() == STORAGE_DMABUFS) { |
| 532 std::vector<int> original_fds; | 533 std::vector<int> original_fds; |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1080 if (zero_initialize_memory) | 1081 if (zero_initialize_memory) |
| 1081 memset(data, 0, data_size); | 1082 memset(data, 0, data_size); |
| 1082 | 1083 |
| 1083 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) | 1084 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) |
| 1084 data_[plane] = data + offset[plane]; | 1085 data_[plane] = data + offset[plane]; |
| 1085 | 1086 |
| 1086 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); | 1087 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); |
| 1087 } | 1088 } |
| 1088 | 1089 |
| 1089 } // namespace media | 1090 } // namespace media |
| OLD | NEW |