Skip to content

Commit dfb2c67

Browse files
committed
Merge branch 'fix/SDK-5681' into 'release/v10.0.0'
SDK-5681 Metadata is not correctly set for synced videos (Hotfix for v10.0.0) See merge request sdk/sdk!7004
2 parents 0776872 + 4df9072 commit dfb2c67

File tree

4 files changed

+54
-12
lines changed

4 files changed

+54
-12
lines changed

src/commands.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,10 +1197,6 @@ CommandPutNodes::CommandPutNodes(MegaClient* client,
11971197
else
11981198
{
11991199
client->pendingattrstring(nn[i].uploadhandle, &s);
1200-
1201-
#ifdef USE_MEDIAINFO
1202-
client->mediaFileInfo.addUploadMediaFileAttributes(nn[i].uploadhandle, &s);
1203-
#endif
12041200
}
12051201

12061202
if (s.size())

src/megaclient.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6460,6 +6460,10 @@ void MegaClient::pendingattrstring(UploadHandle h, string* fa)
64606460
}
64616461
}
64626462
}
6463+
#ifdef USE_MEDIAINFO
6464+
// Append MediaInfo attributes, if any
6465+
mediaFileInfo.addUploadMediaFileAttributes(h, fa);
6466+
#endif
64636467
}
64646468

64656469
// Upload file attribute data to fa servers. node handle can be UNDEF if we are giving fa handle back to the app

tests/integration/SdkTest_test.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13995,20 +13995,18 @@ TEST_F(SdkTest, SdkTargetOverwriteTest)
1399513995
}
1399613996

1399713997
/**
13998-
* @brief TEST_F SdkTestAudioFileThumbnail
13998+
* @brief TEST_F SdkTestAudioFileAttributes
1399913999
*
14000-
* Tests extracting thumbnail for uploaded audio file.
14000+
* Tests extracting thumbnail and other metadata for uploaded audio file.
1400114001
*
14002-
* The file to be uploaded must exist or the test will fail.
14003-
* File is expected at the directory returned by getTestDataDir().
1400414002
*/
14005-
#if !USE_FREEIMAGE || !USE_MEDIAINFO
14006-
TEST_F(SdkTest, DISABLED_SdkTestAudioFileThumbnail)
14003+
#ifndef USE_MEDIAINFO
14004+
TEST_F(SdkTest, DISABLED_SdkTestAudioFileAttributes)
1400714005
#else
14008-
TEST_F(SdkTest, SdkTestAudioFileThumbnail)
14006+
TEST_F(SdkTest, SdkTestAudioFileAttributes)
1400914007
#endif
1401014008
{
14011-
LOG_info << "___TEST Audio File Thumbnail___";
14009+
LOG_info << "___TEST Audio thumbnail and metadata___";
1401214010

1401314011
static const std::string AUDIO_FILENAME = "test_cover_png.mp3";
1401414012
ASSERT_TRUE(getFileFromArtifactory("test-data/" + AUDIO_FILENAME, AUDIO_FILENAME));
@@ -14029,7 +14027,12 @@ TEST_F(SdkTest, SdkTestAudioFileThumbnail)
1402914027
nullptr /*cancelToken*/))
1403014028
<< "Cannot upload test file " << AUDIO_FILENAME;
1403114029
std::unique_ptr<MegaNode> node(megaApi[0]->getNodeByPath(AUDIO_FILENAME.c_str(), rootnode.get()));
14030+
ASSERT_TRUE(node);
14031+
14032+
ASSERT_EQ(node->getDuration(), 2) << "Duration of the audio file is not correct.";
14033+
#if defined(USE_FREEIMAGE)
1403214034
ASSERT_TRUE(node->hasPreview() && node->hasThumbnail());
14035+
#endif
1403314036
}
1403414037

1403514038
/**

tests/integration/sdk_test_sync_upload_operations_test.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,4 +234,43 @@ TEST_F(SdkTestSyncUploadsOperations, DuplicatedFilesUploadDifferentMtime)
234234
ASSERT_NO_FATAL_FAILURE(waitForSyncToMatchCloudAndLocalExhaustive());
235235
}
236236

237+
/**
238+
* @brief SdkTestSyncUploadsOperations.MultimediaFileUpload
239+
*
240+
* Test the metadata and thumbnails from a synced video.
241+
*
242+
*/
243+
#if !defined(USE_FREEIMAGE) && !defined(USE_MEDIAINFO)
244+
TEST_F(SdkTestSyncUploadsOperations, DISABLED_MultimediaFileUpload)
245+
#else
246+
TEST_F(SdkTestSyncUploadsOperations, MultimediaFileUpload)
247+
#endif
248+
{
249+
static const string VIDEO_FILE = "sample_video.mp4";
250+
static const int AVC1_FORMAT = 887; // ID from MediaInfo
251+
252+
static const std::string logPre = getLogPrefix();
253+
LOG_verbose << logPre << "Upload a multimedia file in a sync";
254+
255+
// Get file in the sync path to be uploaded by the sync.
256+
ASSERT_TRUE(getFileFromArtifactory("test-data/" + VIDEO_FILE,
257+
fs::absolute(getLocalTmpDir() / VIDEO_FILE)));
258+
259+
ASSERT_NO_FATAL_FAILURE(waitForSyncToMatchCloudAndLocalExhaustive());
260+
261+
auto uploadedNode = getNodeByPath(SYNC_REMOTE_PATH + "/" + VIDEO_FILE);
262+
ASSERT_TRUE(uploadedNode);
263+
#ifdef USE_MEDIAINFO
264+
ASSERT_EQ(uploadedNode->getDuration(), 5) << "Duration is not correct or unavailable.";
265+
ASSERT_EQ(uploadedNode->getHeight(), 360) << "Height is not correct or unavailable.";
266+
ASSERT_EQ(uploadedNode->getWidth(), 640) << "Width ID is not correct or unavailable.";
267+
ASSERT_EQ(uploadedNode->getVideocodecid(), AVC1_FORMAT)
268+
<< "Codec ID is not correct or unavailable.";
269+
#endif
270+
#ifdef USE_FREEIMAGE
271+
ASSERT_TRUE(uploadedNode->hasThumbnail())
272+
<< "Thumbnail is not available for the uploaded node.";
273+
#endif
274+
}
275+
237276
#endif // ENABLE_SYNC

0 commit comments

Comments
 (0)