| 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 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 frame->data_[kYPlane] = y_data; | 173 frame->data_[kYPlane] = y_data; |
| 174 frame->data_[kUPlane] = u_data; | 174 frame->data_[kUPlane] = u_data; |
| 175 frame->data_[kVPlane] = v_data; | 175 frame->data_[kVPlane] = v_data; |
| 176 frame->no_longer_needed_cb_ = no_longer_needed_cb; | 176 frame->no_longer_needed_cb_ = no_longer_needed_cb; |
| 177 return frame; | 177 return frame; |
| 178 } | 178 } |
| 179 | 179 |
| 180 // static | 180 // static |
| 181 scoped_refptr<VideoFrame> VideoFrame::WrapVideoFrame( | 181 scoped_refptr<VideoFrame> VideoFrame::WrapVideoFrame( |
| 182 const scoped_refptr<VideoFrame>& frame, | 182 const scoped_refptr<VideoFrame>& frame, |
| 183 const gfx::Rect& visible_rect, |
| 183 const base::Closure& no_longer_needed_cb) { | 184 const base::Closure& no_longer_needed_cb) { |
| 185 DCHECK(IsValidConfig(frame->format(), frame->coded_size(), visible_rect, |
| 186 frame->natural_size())); |
| 184 scoped_refptr<VideoFrame> wrapped_frame(new VideoFrame( | 187 scoped_refptr<VideoFrame> wrapped_frame(new VideoFrame( |
| 185 frame->format(), frame->coded_size(), frame->visible_rect(), | 188 frame->format(), frame->coded_size(), visible_rect, |
| 186 frame->natural_size(), frame->GetTimestamp(), frame->end_of_stream())); | 189 frame->natural_size(), frame->GetTimestamp(), frame->end_of_stream())); |
| 187 | 190 |
| 188 for (size_t i = 0; i < NumPlanes(frame->format()); ++i) { | 191 for (size_t i = 0; i < NumPlanes(frame->format()); ++i) { |
| 189 wrapped_frame->strides_[i] = frame->stride(i); | 192 wrapped_frame->strides_[i] = frame->stride(i); |
| 190 wrapped_frame->data_[i] = frame->data(i); | 193 wrapped_frame->data_[i] = frame->data(i); |
| 191 } | 194 } |
| 192 | 195 |
| 193 wrapped_frame->no_longer_needed_cb_ = no_longer_needed_cb; | 196 wrapped_frame->no_longer_needed_cb_ = no_longer_needed_cb; |
| 194 return wrapped_frame; | 197 return wrapped_frame; |
| 195 } | 198 } |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 break; | 503 break; |
| 501 for (int row = 0; row < rows(plane); ++row) { | 504 for (int row = 0; row < rows(plane); ++row) { |
| 502 base::MD5Update(context, base::StringPiece( | 505 base::MD5Update(context, base::StringPiece( |
| 503 reinterpret_cast<char*>(data(plane) + stride(plane) * row), | 506 reinterpret_cast<char*>(data(plane) + stride(plane) * row), |
| 504 row_bytes(plane))); | 507 row_bytes(plane))); |
| 505 } | 508 } |
| 506 } | 509 } |
| 507 } | 510 } |
| 508 | 511 |
| 509 } // namespace media | 512 } // namespace media |
| OLD | NEW |