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

Unified Diff: media/base/mac/videotoolbox_helpers.cc

Issue 2292683002: Fix AnnexB header bytes for VideoToolbox (Closed)
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/mac/videotoolbox_helpers.cc
diff --git a/media/base/mac/videotoolbox_helpers.cc b/media/base/mac/videotoolbox_helpers.cc
index 593a1850eaea64e37944d592699a2d0a9e45cdc8..f3507d9d6eb2711909af996081a184559c633159 100644
--- a/media/base/mac/videotoolbox_helpers.cc
+++ b/media/base/mac/videotoolbox_helpers.cc
@@ -13,6 +13,10 @@ namespace media {
namespace video_toolbox {
+namespace {
+static const char kAnnexBHeaderBytes[4] = {0, 0, 0, 1};
+} // anonymous namespace
+
base::ScopedCFTypeRef<CFDictionaryRef>
DictionaryWithKeysAndValues(CFTypeRef* keys, CFTypeRef* values, size_t size) {
return base::ScopedCFTypeRef<CFDictionaryRef>(CFDictionaryCreate(
@@ -113,7 +117,6 @@ void CopyNalsToAnnexB(char* avcc_buffer,
static_assert(sizeof(NalSizeType) == 1 || sizeof(NalSizeType) == 2 ||
sizeof(NalSizeType) == 4,
"NAL size type has unsupported size");
- static const char startcode_3[3] = {0, 0, 1};
DCHECK(avcc_buffer);
DCHECK(annexb_buffer);
size_t bytes_left = avcc_size;
@@ -125,7 +128,7 @@ void CopyNalsToAnnexB(char* avcc_buffer,
avcc_buffer += sizeof(NalSizeType);
DCHECK_GE(bytes_left, nal_size);
- annexb_buffer->Append(startcode_3, sizeof(startcode_3));
+ annexb_buffer->Append(kAnnexBHeaderBytes, sizeof(kAnnexBHeaderBytes));
annexb_buffer->Append(avcc_buffer, nal_size);
bytes_left -= nal_size;
avcc_buffer += nal_size;
@@ -203,8 +206,7 @@ bool CopySampleBufferToAnnexBBuffer(CoreMediaGlue::CMSampleBufferRef sbuf,
<< status;
return false;
}
- static const char startcode_4[4] = {0, 0, 0, 1};
- annexb_buffer->Append(startcode_4, sizeof(startcode_4));
+ annexb_buffer->Append(kAnnexBHeaderBytes, sizeof(kAnnexBHeaderBytes));
annexb_buffer->Append(reinterpret_cast<const char*>(pset), pset_size);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698