A Cognitive Media Sharing System Using D2D Communication and Ultrasonic Sensor