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

Side by Side Diff: media/base/video_frame.cc

Issue 581803003: Define a new media_cast component for iOS cast builds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix cast_receiver and cast_sender dependency list; change how media_for_cast_ios builds media:share… Created 6 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.h ('k') | media/cast/BUILD.gn » ('j') | 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/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"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/aligned_memory.h" 12 #include "base/memory/aligned_memory.h"
13 #include "base/strings/string_piece.h" 13 #include "base/strings/string_piece.h"
14 #include "gpu/command_buffer/common/mailbox_holder.h" 14 #include "gpu/command_buffer/common/mailbox_holder.h"
15 #include "media/base/limits.h" 15 #include "media/base/limits.h"
16 #include "media/base/video_util.h" 16 #include "media/base/video_util.h"
17
18 #if !defined(MEDIA_FOR_CAST_IOS)
17 #include "third_party/skia/include/core/SkBitmap.h" 19 #include "third_party/skia/include/core/SkBitmap.h"
20 #endif
18 21
19 namespace media { 22 namespace media {
20 23
21 static inline size_t RoundUp(size_t value, size_t alignment) { 24 static inline size_t RoundUp(size_t value, size_t alignment) {
22 // Check that |alignment| is a power of 2. 25 // Check that |alignment| is a power of 2.
23 DCHECK((alignment + (alignment - 1)) == (alignment | (alignment - 1))); 26 DCHECK((alignment + (alignment - 1)) == (alignment | (alignment - 1)));
24 return ((value + (alignment - 1)) & ~(alignment - 1)); 27 return ((value + (alignment - 1)) & ~(alignment - 1));
25 } 28 }
26 29
27 // Rounds up |coded_size| if necessary for |format|. 30 // Rounds up |coded_size| if necessary for |format|.
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 natural_size, 177 natural_size,
175 mailbox_holder.Pass(), 178 mailbox_holder.Pass(),
176 timestamp, 179 timestamp,
177 false)); 180 false));
178 frame->mailbox_holder_release_cb_ = mailbox_holder_release_cb; 181 frame->mailbox_holder_release_cb_ = mailbox_holder_release_cb;
179 frame->read_pixels_cb_ = read_pixels_cb; 182 frame->read_pixels_cb_ = read_pixels_cb;
180 183
181 return frame; 184 return frame;
182 } 185 }
183 186
187 #if !defined(MEDIA_FOR_CAST_IOS)
184 void VideoFrame::ReadPixelsFromNativeTexture(const SkBitmap& pixels) { 188 void VideoFrame::ReadPixelsFromNativeTexture(const SkBitmap& pixels) {
185 DCHECK_EQ(format_, NATIVE_TEXTURE); 189 DCHECK_EQ(format_, NATIVE_TEXTURE);
186 if (!read_pixels_cb_.is_null()) 190 if (!read_pixels_cb_.is_null())
187 read_pixels_cb_.Run(pixels); 191 read_pixels_cb_.Run(pixels);
188 } 192 }
193 #endif
189 194
190 // static 195 // static
191 scoped_refptr<VideoFrame> VideoFrame::WrapExternalPackedMemory( 196 scoped_refptr<VideoFrame> VideoFrame::WrapExternalPackedMemory(
192 Format format, 197 Format format,
193 const gfx::Size& coded_size, 198 const gfx::Size& coded_size,
194 const gfx::Rect& visible_rect, 199 const gfx::Rect& visible_rect,
195 const gfx::Size& natural_size, 200 const gfx::Size& natural_size,
196 uint8* data, 201 uint8* data,
197 size_t data_size, 202 size_t data_size,
198 base::SharedMemoryHandle handle, 203 base::SharedMemoryHandle handle,
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 break; 924 break;
920 for (int row = 0; row < rows(plane); ++row) { 925 for (int row = 0; row < rows(plane); ++row) {
921 base::MD5Update(context, base::StringPiece( 926 base::MD5Update(context, base::StringPiece(
922 reinterpret_cast<char*>(data(plane) + stride(plane) * row), 927 reinterpret_cast<char*>(data(plane) + stride(plane) * row),
923 row_bytes(plane))); 928 row_bytes(plane)));
924 } 929 }
925 } 930 }
926 } 931 }
927 932
928 } // namespace media 933 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_frame.h ('k') | media/cast/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698