One way would be to take a look at the binary data while you already have it in your hands. According to this File signatures table both MP3 and AAC have unique magic headers:
49 44 33
for MPEG-1 Audio Layer 3 (MP3) audio fileFF F1
for MPEG-4 Advanced Audio Coding (AAC) Low Complexity (LC) audioFF F9
for MPEG-2 Advanced Audio Coding (AAC) Low Complexity (LC) audio