Bläddra i källkod

Examples: Fixed track send error checking in streamer

Paul-Louis Ageneau 3 år sedan
förälder
incheckning
33bc1b8922
1 ändrade filer med 4 tillägg och 8 borttagningar
  1. 4 8
      examples/streamer/main.cpp

+ 4 - 8
examples/streamer/main.cpp

@@ -379,17 +379,13 @@ shared_ptr<Stream> createStream(const string h264Samples, const unsigned fps, co
                 if (rtpConfig->timestampToSeconds(reportElapsedTimestamp) > 1) {
                     trackData->sender->setNeedsToReport();
                 }
+
                 cout << "Sending " << streamType << " sample with size: " << to_string(sample.size()) << " to " << client << endl;
-                bool send = false;
                 try {
                     // send sample
-                    send = trackData->track->send(sample);
-                } catch (...) {
-                    send = false;
-                }
-                if (!send) {
-                    cerr << "Unable to send "<< streamType << " packet" << endl;
-                    break;
+                    trackData->track->send(sample);
+                } catch (const std::exception &e) {
+                    cerr << "Unable to send "<< streamType << " packet: " << e.what() << endl;
                 }
             }
         }