Skip to content

Instantly share code, notes, and snippets.

@courville
Created December 13, 2019 14:06
Show Gist options
  • Save courville/2fe4056f2846319f69368f80fc63c2be to your computer and use it in GitHub Desktop.
Save courville/2fe4056f2846319f69368f80fc63c2be to your computer and use it in GitHub Desktop.
avos: do not apply MediaCodec AR
diff --git a/external/android/libsfdec/sfdec_ndkmediacodec.cpp b/external/android/libsfdec/sfdec_ndkmediacodec.cpp
index 57f6c7e..56752c0 100644
--- a/external/android/libsfdec/sfdec_ndkmediacodec.cpp
+++ b/external/android/libsfdec/sfdec_ndkmediacodec.cpp
@@ -76,12 +76,12 @@ static int init_renderer(sfdec_priv_t *sfdec)
if (format != NULL) {
if (AMediaFormat_getInt32(format, "width", &width)) {
- LOG("width changed: %d -> %d", sfdec->width, width);
- sfdec->width = width;
+ LOG("width NOT changed: %d -> %d", sfdec->width, width);
+ //sfdec->width = width;
}
if (AMediaFormat_getInt32(format, "height", &height)) {
- LOG("height changed: %d -> %d", sfdec->height, height);
- sfdec->height = height;
+ LOG("height NOT changed: %d -> %d", sfdec->height, height);
+ //sfdec->height = height;
}
}
@@ -268,13 +268,14 @@ static int sfdec_read(sfdec_priv_t *sfdec, int64_t seek, sfdec_read_out_t *read_
return 0;
} else if (index == AMEDIACODEC_INFO_OUTPUT_FORMAT_CHANGED) {
+ // here we init renderer based on codec information that could be erroneous and yield to incorrect AR
if (init_renderer(sfdec))
continue;
read_out->flag |= SFDEC_READ_SIZE;
read_out->size.width = sfdec->width;
read_out->size.height = sfdec->height;
read_out->size.interlaced = 0;
- DBG LOG("INFO_FORMAT_CHANGED: %dx%d", sfdec->width, sfdec->height);
+ LOG("INFO_FORMAT_CHANGED: %dx%d", sfdec->width, sfdec->height);
return 0;
} else if (index == AMEDIACODEC_INFO_OUTPUT_BUFFERS_CHANGED) {
DBG LOG("INFO_OUTPUT_BUFFERS_CHANGED");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment